title: How to detect the end of a line from a file stream in C++
body: <p>I have csv file input where I read in multiple lines which contain multiple fields related to that line. How do I write a loop which reads a line of text from the csv file, then keeps looping until it reaches the end of that line. This while loop would be nested in an !infile.eof while loop. Here is what I has so far but doesn't work exactly.</p>
  
  <pre><code>while (getline(infile, currentline))
  {
  
      getline(infile, ID, ',');
      getline(infile, Name, ';');
  
  Person p = new Person(ID, Name);
  
  }
  </code></pre>
  
  <p>A line in the csv file looks like this: 
  111, james; 222, lynda; 333, luke; </p>
  
  <p>Each line represents a classroom so there would be multiple lines.</p>