[Solved] Unexpected behavior with atEnd()
General and Desktop
3
Posts
2
Posters
1.6k
Views
1
Watching
-
I have a CSV file with the following data:
one,1.7,3[cr][lf]
two,3.8,18[cr][lf]I then attempt to read the file with the following code:
@
QFile file("recipe.csv");
if(file.open(QFile::ReadOnly | QFile::Text))
{
QTextStream in(&file);
QString myLine = in.readLine();
if(file.atEnd())
ui->label_2->setText("EOF");
@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?