[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

'Filing' structure



I have lots of objects types in the game, each of wich is described by a 
structure.
For a variety of reasons (saving info or sending it to a client) i must 
translate this information in a machine indpiendent (and run-time 
indipendent) format, ie i must translate all pointers to integer vector index 
and all integers to either big-endian or little endian, assuming that chars, 
floats and doubles have the same internal rapresentation on all kind of 
machines my game is likely to run.

I'd like some suggestion about the topic, as making this in plain C seems very 
boring: for each structure i must write a fucntion to convert it to a 
unsigned char array and another to convert it back (checking for possible 
invalid values): the smallest change i make on the structure must be applied 
to the functions also...

Any idea?
Thanx,
Francesco Orsenigo