how can i force the compiler to use 1 byte alignment ?
I reed a binary file into a structure, .for now the bytes don’t fall into
the right structure members.
How to solve this ?
Johan
how can i force the compiler to use 1 byte alignment ?
I reed a binary file into a structure, .for now the bytes don’t fall into
the right structure members.
How to solve this ?
Johan
In gcc you can play with the packed attribute.
http://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_4.html#IDX302
-seanb
Sagaert Johan <sagaert.j@belgacom.net> wrote:
how can i force the compiler to use 1 byte alignment ?
I reed a binary file into a structure, .for now the bytes don’t fall into
the right structure members.How to solve this ?
Johan
Sagaert Johan <sagaert.j@belgacom.net> wrote:
how can i force the compiler to use 1 byte alignment ?
I reed a binary file into a structure, .for now the bytes don’t fall into
the right structure members.How to solve this ?
Which OS?
For QNX4, try:
#pragma pack( push, 1);
struct {}
#pragma pack( pop );
For QNX6, try:
#include _pack1.h
struct {}
#include _packpop.h
QNX Training Services
http://www.qnx.com/services/training/
Please followup in this newsgroup if you have further questions.