title: Count number of lines in a text file
body: <p>I need to count the number of lines in a text file. This is the code I have right now.    </p>
  
  <pre><code>CStdioFile sampleFile;
  sampleFile.Open("test.txt",CFile::modeRead );
  long length = 1;
  CString row("");
  while(sampleFile.ReadString(row))
  {
      length++;
  }
  </code></pre>
  
  <p>This isn't working. I'm not getting the correct value of the number of lines in the text file.What is wrong with this?</p>
  
  <p>Thanks.</p>