[Interest] reading from and writing to a file with QDataStream
william.crocker at analog.com
william.crocker at analog.com
Mon Mar 7 19:00:09 CET 2016
>>
>> QDataStream out2(&file); // and module A write those datas to a file.
>> out2 << bai.size();
>> out2 << bai;
>
All of the following is IMHO:
I think that if you are going to read the size back as an 'int'
you should insure that an 'int' is written in the first place:
out2 << (int)bai.size();
Sure, you can look and see that the size() of a QByteArray returns
an 'int', but that is only as of today. You should get into the habit
of controlling the types written to QDataStreams.
Bill
More information about the Interest
mailing list