Mail Archives: djgpp/1997/06/17/10:53:31
Dear DJGPP users!
Recently I came across something weird:
I have two structs:
struct s1 { char c1; char c2; short s};
struct s2 { char c1; short s; char c2};
A call to sizeof will return 4 for s1 and 6 (!) for s2.
It seems like the size of the chars in s2 gets increased to 2.
Now I wouldn't care much, if it weren't for writing and reading these
structs to binary files.
A file containing s1 will have 4 bytes, while a file with s2 will have
six.
I have to access binary files, which were created with a program someone
else wrote (and compiled), and it seems like his program would count
4 bytes for both sizes.
The binary files are rather huge and contain several big structs.
Does anybody know of a compiler option or some other way to get DJGPP
to use 1 byte chars regardless of their context?
You could really do me a great favour!
Manni Heumann
Bielefeld, Germany
- Raw text -