[Interest] reading from and writing to a file with QDataStream
william.crocker at analog.com
william.crocker at analog.com
Tue Mar 8 12:44:25 CET 2016
>> 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.
> Actually, for reading and writing binary data files, I think it is wise to get
> into the habbit of using explicitly sized types. That is, write out and read
> back a qint8, a qint32 or a qint64, not an int or a long. int and other integer
> types are not guaranteed to be the same size across platforms, so you may get
> into trouble if you are not explicit about how many bytes you want or expect
> your values to be encoded in.
>
Yes. Even better.
> André
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
More information about the Interest
mailing list