End Google Ads 201810 - BS.net 01 --> My Windows MFC Application will receive a structure from a Unix machine (Big Endian) over UDP.

The structure has the following data types:-

struct RXData {
double timeStamp;
double item1;
long item2;
double item3;
int flag1;
bool state;
};

What do I need to do on the Windows platform to get the data in the correct format; i.e. do I use procedures like theses below - I did try but still not getting the correct answer.

float swap(float d)
{
float a;
unsigned char *dst = (unsigned char *)&a;
insigned char *src = (unsigned char *)&d;
dst[0] = src[3];
dst[1] = src[2];
dst[2] = src[1];
dst[3] = src[0];
return a;
}

short convert_short(short in)
{
short out;
char *p_in = (char *) ∈
char *p_out = (char *) &out;
p_out[0] = p_in[1];
p_out[1] = p_in[0];
return out;
}

The floats give incorrect values.

Any suggestions for this simple scheme please.

Regards,

Andy.