Hey everyone, I'm new here.
I'm writing C code for an embedded platform where I have to stream specific messages (that I do not define) in and out an interface to another device.
The compiler I must use does not support the #pragma pack directive (or any other directive to tweak structure member alignment).
I have (about 50) structures set up that define the messages that will be passed in and out of the interface. But when I try to lay my structures onto the byte streams, things don't work out correctly because of the padding that the compiler is inserting between structure members.
Does anyone have any ideas about how I can convert my data to and from padded structures to un-padded byte arrays without having to write separate stream in/out functions for each structure?
By the way, my code has to be very portable (read 100% ANSI C).
I'd really appreciate any insight anyone has here. Thanks!