title: I'm using a nested while loop to Parse a text file with multiple lines but for some reason, it only goes through the first line and I don't know why
body: <p><br>I'm using a nested while loop to Parse a text file with multiple lines but for some reason, it only goes through the first line and I don't know why. </p>
  <pre><code>              string file;
                string line;
                cout &lt;&lt; &quot;Whats the file name?&quot; &lt;&lt; endl;
                cin &gt;&gt; file;
              
                string inputStr;
                string buf; // Have a buffer string
                stringstream s; // create the string stream
                int field = 0;
                string input; //string for the input (i.e. name, ID, etc.)
              
                ifstream InFile(file.c_str());
                if (InFile.is_open()) {
                  cout &lt;&lt; &quot;File found&quot; &lt;&lt; endl;
              
                  while (getline(InFile, line)) {
                    cout &lt;&lt; line &lt;&lt; endl;
                    inputStr = line;
                    s &lt;&lt; inputStr; //put the line into the stream
                    while (getline(s, input, ' ')) { //gets a string from the stream up the next comma 
                      field++;
                      cout &lt;&lt; &quot; field&quot; &lt;&lt; field &lt;&lt; &quot; is &quot; &lt;&lt; input &lt;&lt; endl;
                    }
                    cout &lt;&lt; &quot;DONE&quot; &lt;&lt; endl;
              
                  }
  </code></pre>