[Solved] Unexpected behavior with atEnd()
I have a CSV file with the following data:
I then attempt to read the file with the following code:
if(file.open(QFile::ReadOnly | QFile::Text))
QString myLine = in.readLine();
The value of myLine is one,1.7,3 (so I know only the first line was read instead of the entire file). The problem is that atEnd() is also true. Shouldn't I get atEnd() true after reading the second line?
Just a guess, but the QTextStream may have prefetched and buffered the entire contents of your file, such that file.atEnd() might return true, but in.atEnd() might still return false.
Good guess. When I query in.atEnd(), it is false.