title: Checking stringstream line char by char C++
body: <p>I will keep it short and simple. After making sure that user is able to open a file succesfully, I have written the following piece of code to take a line from the inputFile.</p>
  
  <pre><code>string line;
  int counter = 0;
  
  DynIntStack stack;
  
  while (!inputFile.eof())
  {
      getline(inputFile, line);
      stringstream inputLine(line);
      counter++;
  
      //I NEED TO DO IT HERE
  }
  </code></pre>
  
  <p>This will be used to write program to check balanced paranthesis in an input cpp file and I have to use stacks. Classic CS homework as I understand from the topics I have checked :)</p>
  
  <p>counter is updated after every line and the line number(counter) is to be pushed to the stack if it has a opening bracket and it must be popped from the stack if it is a closing bracket. after these, the output should look something like this:</p>
  
  <pre><code>block: 3 - 3
  block: 12 - 14
  block: 10 - 14
  block: 5 - 16
  Syntax error in line 21.
  </code></pre>
  
  <p>But I do not know how to check the line I got char by char. I need a loop to check the chars and apply the previously mentioned things if an opening or closing bracket is found. How can I check the line char by char. </p>
  
  <ul>
  <li>using any data container other than stacks is forbidden. </li>
  </ul>
  
  <p>thank you very much :)</p>