I would go one of two routes:
a) store the structure as a text file.
b) pack the structure with #pragma's, read each member in individually, and pass to a (conditionally compiled) byte reversal function.
Code:
void
convert_to_little_endian(void * ptr, size_t size)
{
#ifdef BIG_ENDIAN_MACHINE
char
temp,
* begin = (char*)ptr,
* end = begin + size;
while(begin < --end)
{
temp = *end;
*end = *begin;
*begin++ = temp;
}
#endif
}
int
main(void)
{
short
value;
convert_to_little_endian(&value, sizeof(short));
}