You seem to be understanding that serializing with QDataStream is a non-trivial operation, but at the same time you expect deserialization to be done by bit-for-bit reinterpretation. This is dangerously wrong. If you use QDataStream to serialize, you must use QDataStream to deserialize.
You seem to be understanding that serializing with QDataStream is a non-trivial operation, but at the same time you expect deserialization to be done by bit-for-bit reinterpretation. This is dangerously wrong. If you use QDataStream to serialize, you must use QDataStream to deserialize.
Added after 5 minutes:
By the way, your code should not depend on the precise layout of the serialized data. Just let QDataStream encode and decode, or design your own format as I explained before. Also, do not use types such as "unsigned int" in your structure because the range of values of this type depends on the architecture. Use a fixed-size type such as uint32_t.
Bookmarks