I have objects that I like to be able to serialize as a consecutive stream of bytes. Two questions:
1) Is an array of char
appropriate for this task? If not what are better options?
2) What is the most efficient of doing this? So far what I have done is using memcpy
. Is it possible to cast/convert a double
, for instance, into 8 bytes of chars
and vice versa without going through memcpy
?
I'm well aware of external libraries for this but I like to learn new stuff.