Good point, packing must be taken into consideration too. I actually meant memberwise serialisation of the structure, with "smart" handling of dynamically sized members such as strings and containers.
Is the packing of a struct standardized by C++ for POD types?
The OP appears to be using C, (potentially via a C++ compiler). That said, I believe neither language guarantees any sort of standard packing behaviour.