V
Voronkov Konstantin
Thank you for answer, but I still did not
got *how* to make serialization of enum type.
Can you provide more instructions or hint, please?
My task is to serialize enum to something like byte array,
and then load enum from that byte array to the same enum
type on other platform.
One way to do I see is:
- static cast enum to integer
- convert integer to network byte order with htonl()
- transmit the result via network to remote host
- get result and convert it to host byte order with ntohl()
- cast integer back to enum
Is it portable way? Is there any well-known
tenchnics for such kind of tasks?
Thanks for help,
Konstantin
got *how* to make serialization of enum type.
Can you provide more instructions or hint, please?
My task is to serialize enum to something like byte array,
and then load enum from that byte array to the same enum
type on other platform.
One way to do I see is:
- static cast enum to integer
- convert integer to network byte order with htonl()
- transmit the result via network to remote host
- get result and convert it to host byte order with ntohl()
- cast integer back to enum
Is it portable way? Is there any well-known
tenchnics for such kind of tasks?
Thanks for help,
Konstantin