That is because your compiler optimises the code for speed, so it aligns your data to 4byte blocks…
solving your problem (dirt way, i think):
struct{
char dummy[3];//this space is unused like in your code
char ch;
int num
} x;
//by reading data you have to correct the pointer:
char *ptr= (char *)&x + 3;
[This message has been edited by T2k (edited 12-11-2001).]
The latter version will revert to the previously used pack method (=nice), whereas the former will leave it at 1 (=not so nice), which is not what subsequent code may expect.