I'm not sure what you are doing, but it might be a packing issue. By default, MS compilers line-up data in structure to an 8 byte boundary (makes it easier on the memory controller). You can override this behavior with the #pragma pack option:
Code:
#pragma pack(push,1)
struct test
{
struct header
{
int a;
int b;
};
uint8_t c;
uint8_t d;
uint8_t e;
uint32_t f;
};
struct test2
{
uint8_t n;
uint8_t m;
uint8_t p;
};
#pragma pack(pop)