title: C++ Getline & seekg
body: <p>I have written a C++ program I have multiple of CSV file used as input, which I open one at a time and close it after extracting data to a output file which is the only file.</p>
  
  <p>I run getline(inFile,line);
  outFile &lt;&lt; line &lt;&lt; endl;</p>
  
  <p>I run this code, only only few files it suddenly output after about 200-300 line after and have a big whitespace in my output CSV file</p>
  
  <p>But when I slower the code, like system("Pause") in the loop, I can get extract what I want perfectly....</p>
  
  <p>Is my program running to fast, why getline would be skipping part of what things I want?</p>
  
  <p>I really have no idea where the problem is coming from, or where to start </p>
  
  <p>Many Thanks!</p>
  
  <pre><code>if (dataname[i] == dataname)
  {
      inFile.seekg(datalength[i], ios::beg);
      for (int j = 0; j &lt; datacount[i]; j++)
      {
          getline(inFile, line);
          outFile &lt;&lt; line &lt;&lt; endl;
      }
  
  }
  </code></pre>