QTextStream malfunction of read method
-
My program reads QTextStream. It has 43kb. Correctly read data marked in green. The green ones were read in twos. Then the pink was read as one byte, and then the reading method skips one byte. I am expecting 0x0000, but gives me 0x00A4.
When I change 0x0000 to (for example) 0x0102 in the source file, the read method works correctly.What is wrong?
-
@BartoszT said in QTextStream malfunction of read method:
What is wrong?
You're trying to read a non-text file with QTextStream.
Use QFile::read() or QFile::readAll() instead.
-
@Christian-Ehrlicher said in QTextStream malfunction of read method:
@BartoszT said in QTextStream malfunction of read method:
What is wrong?
You're trying to read a non-text file with QTextStream.
Indeed. 0x0000 is not text, so QTextStream does not handle it.
Use QFile::read() or QFile::readAll() instead.
Agreed.
-
Hi and welcome to devnet,
Since it's binary data, QByteArray.