Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.14
-
Fedora 32, x86_64
Description
Reading line by line from a UTF-8 file using QTextStream in a loop till QFile::atEnd(), seems to stop midway. I have attached a simple test program and input file to recreate the problem. The program simply reads the file line by line and increments a line number variable. Finally, outside the loop, the line number is printed. It is found to be much less than the total lines in the file.
I spotted the problem when I was trying to read a UTF-8 file, filter out some lines and write the rest to another file. There are very weird observations such as difference in outputs with and without explicit calls to QFile::close() just before returning from main().