Qt reads bytes from a file in precisely the order they are in the file. If you a reading 4/8 bytes into a patch of memory and not allowing for byte order differences between the file order and your machine's int/long long order then you end up with int/longlong values that don't reflect what you expect.
The file is in big-endian format (AKA network order) if the bytes are in the order you list. Your processor is most likely little endian (e.g. Intel x86 processors). The first byte in the file (00), the most significant byte from the sender's point of view, ends up in the first byte of the memory set aside for your long long. Your processor treats this as the least-significant byte of the long long.
The functions ntohs() and ntohl() do byte swapping from network to host order for 16- and 32-bit values respectively. See http://stackoverflow.com/questions/8...bit-ntohl-in-c for 64-bit options.
With care you could use QDataStream to read the file and handle the swapping for you.
Bookmarks