Hi,

I'm trying to read from a .txt file using QTextStream.

Here's an idea of what I have in my code:

Qt Code:
  1. while(!file.atEnd())
  2. {
  3. //Read a line from the file
  4. //Do something
  5. }
To copy to clipboard, switch view to plain text mode 

The problem is that file.atEnd() returns 'true' after the loops is executed once, even when there is more than one line in the file. What is wrong?

PS: The .txt file that is read from is one that was generated in a different section of the same program as the above code. It contents are organized into columns, and when a new line is written in the file, the end of the old line is signified with the "\r\n" characters. (I really hope this makes sense ).