title: Move to next line in a file C++
body: <p>Here is an incomplete fraction of a program I am writing. To summarize, the program takes info from an input file ( a name and ID then a series of numbers) does some math and then prints the answers in an output file. Right now the program prints the name and the ID, and then it prints the numbers over and over and over and over. I would like it to move to the next line, print the name and ID and repeat until the file is over</p>
  
  <p>Professor says that I should be using getline, but that doesnt make any sense to me</p>
  
  <pre><code>do
  {
    infile &gt;&gt; name &gt;&gt; Id;
    cout&lt;&lt; name &lt;&lt; Id &lt;&lt; std::endl;
    hworkgrade = CalHworkGrade(grade1, infile);
    printRecord(name, Id, outfile);
  }
  while(!infile.eof());
  </code></pre>
  
  <p>input:</p>
  
  <pre>
  Morgan 12388671 100 100 100 
  John 67894 100 100 100 
  </pre>
  
  <p>output:</p>
  
  <pre>
  Vagts,Morgan
  100100
  100100
  100100
  100100
  100100
  (300,000 more times)
  </pre>
  
  <p>Update: </p>
  
  <pre><code>do
  {
    while (getline (infile, line))
    {
    istringstream iss(line);
    iss &gt;&gt; name &gt;&gt; Id;
    cout&lt;&lt; name &lt;&lt; Id;
    hworkgrade = CalHworkGrade(grade1, infile);
    printRecord(name, Id, outfile);
    }
  }
  </code></pre>
  
  <p>while(!infile.eof());</p>