I am trying to write 512 bytes as unsigned char, but read them as fields in a struct. Below is the union I have come up with.
typedef union {
unsigned char buffer[512]; //512 bytes
struct {
unsigned char a[446];
struct part b[4]; //sizeof(part) = 16
unsigned char c[2];
}parsed; //446 + 4*16 + 2 = 512 bytes
}tbl;
I can write into buffer properly, but reading from a or b or c give 0. - I am using gcc - on a 64 bit Linux machine - No difference with/without -m32 flag.
Can someone please throw some light what I'm missing?