I thought everything was going fine until I compared the data I wrote into the binary file with the data I am reading, everything is the same except 6 bytes which are missing during reading!!
file.write(towrite);
qDebug()<<towrite.toHex();
file.write(towrite);
qDebug()<<towrite.toHex();
To copy to clipboard, switch view to plain text mode
data=file.readAll();
qDebug()<<data.toHex();
QByteArray data;
data=file.readAll();
qDebug()<<data.toHex();
To copy to clipboard, switch view to plain text mode
the first piece of code gives:
"400000931bad9c77bfbfbfbfb5eb75dfdfdfdfea40c870101 0101debebf80808080fc10ecc0c0c0c0ea76a8e06060605153 667050505051ca2cb82828282055c33c1c1c1c19faa0b60e0e 0e0c8b373309090908c1a9e7858585854a603dc2c2c2c2f717 b461a1a1a19d64db70d0d0d0c67e81b87878787e60539c3c3c3c3883988e2222222342856b 11111110c7226589898989f6a8e907b7d"
while the second gives:
"400000931bad9c77bfbfbfbfb5eb75dfdfdfdfea40c870101 0101debebf80808080fc10ecc0c0c0c0ea76a8e06060605153 667050505051ca2cb82828282055c33c1c1c1c19faa0b60e0e 0e0c8b373309090908c1a9e7858585854a603dc2c2c2c2f717 b461a1a1a19d64db70c67e81b87878787e60539c3c3c3c3883 988e2222222342856b11111110c7226589898989f6a8e907b7 d"
Please help!
I checked the binary file using a hex editor and the writing process was successful, nothing is missing.
Added after 17 minutes:
Just figured out the problem.. I was reading it as a text file. SOLVED!
Bookmarks