I have this structure which I want to write to a file:
typedef struct
{
char* egg;
unsigned long sausage;
long bacon;
double spam;
} order;
<
If you are using IEEE-754 why not access the float
or double
as a unsigned short
or unsigned long
and save the floating point data as a series of bytes, then re-convert the "specialized" unsigned short
or unsigned long
back to a float
or double
on the other side of the transmission ... the bit-data would be preserved, so you should end-up with the same floating point number after transmission.