E
edware
I want to read header data from a image file,
and I have a struct that represent this header.
But it seems like my compiler pads the data,
resulting that my fread() call won't put the right
things in the right place.
The struct starts like this:
struct header {
char magic[2]; /* 2 bytes */
uint32_t size; /* 4 bytes */
...
};
It seems like my compiler puts two extra
bytes after the magic field, which will
result in a wrong size value.
Is there some standard way to disable the padding?
and I have a struct that represent this header.
But it seems like my compiler pads the data,
resulting that my fread() call won't put the right
things in the right place.
The struct starts like this:
struct header {
char magic[2]; /* 2 bytes */
uint32_t size; /* 4 bytes */
...
};
It seems like my compiler puts two extra
bytes after the magic field, which will
result in a wrong size value.
Is there some standard way to disable the padding?