How to hide byte array structure in C?

Possible duplicates:
How to convert a struct to a char array in C
A portable way to write a C structure to a file (Serialization for C)

I'm looking to convert a structure to an array of bytes in C, and I was confused about this. Please show me the right way to achieve this. Thanks in advance.

+3
source share
1 answer

The structure is an array of bytes. it starts with &mystructand has a length of sizeof(mystruct_type)bytes.

If the binaries are long or contain spaces, check the settings #pragma pack.

Hth

Maro

+1
source

All Articles