title: Issue reading multiple lines from .txt file in C++
body: <p>I'm trying to create a student database system for a school project. I'm trying to create a function that will search a .txt file for the student id and return all of the other variables on the string. This is working great if I search for the id of the student on the first line of the txt file but isn't capturing anything if I search for a student on another line. Am I missing something obvious?</p>
  
  <p>The student data is 16 strings delimited by commas on each line. The student ID is the first string.</p>
  
  <p>Thanks for any assistance!</p>
  
  <pre><code>StudentType findStudent(int studentToFind)
  {
      ifstream inFile;
      inFile.open("students.txt");
  
      string currentLine;
      string dataRead[16];
      istringstream is;
      int currentStudent;
  
      if (inFile)
      {
          while (getline(inFile, currentLine))
          {
              is.str(currentLine);
  
              for (int i = 0; i &lt; 16; i++)
              {
                  getline(is, dataRead[i], ',');
              }
  
              currentStudent = stoi(dataRead[0]);
  
              if (currentStudent == studentToFind)
              {
                  /*
                   Do stuff here
                  */
  
                  inFile.close();
                  return foundStudent;
              }
              cin.ignore(); // Not sure if this is needed but I was trying to 
                            // clear the \n char if that was causing the issue
          }
      }
  }
  </code></pre>