I have struct with the following elements. Plus the structure is complety padded.
typedef struct {
uint16_t a;
uint16_t b;
uint8_t c;
uint8_t d;
uint8_t e[6];
} ad;
This structure is a little endian. I mean when I print this structure on my big endian machine I get the following
if c=1 , d=2, e[0] =3, e[1]=4. I get
c=4, d=3, e[0] = 2 and e[1]=1.
a and b are swapped. further, e[1] is swapped with c and e[0] is swapped with d.
I am using htonl
function like the following. but, it is not working, can anyone suggest me a good answer.