QIODevice::readLine() and QIODevice::readAll() return QByteArrays not QStrings. The QString is being constructed using the conversion constructor, which uses QString::fromAscii(). Depending on the current codec if the first byte of the file is not valid, e.g. a UTF-8 byte-order-mark, then you may well end up with an empty string.
So, what does you file actually contain, and is it valid characters only?
...
On second thoughts, even if your byte array slurped the entire file into memory, conversion to 16-bit characters in a QString will double the size and blow the 4GB limit on 32-bit architectures.
Bookmarks