I need to count the number of lines in a text file. This is the code I have right now.
CStdioFile sampleFile;
sampleFile.Open("test.txt",CFile::modeRead );
long length = 1;
CString row("");
while(sampleFile.ReadString(row))
{
length++;
}
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?
Thanks.