Mail Archives: djgpp/1996/08/07/08:47:04
Eric NICOLAS <nicolas AT dsys DOT ceng DOT cea DOT fr> wrote:
>You simply cannot share binary files between BC and DJGPP.
RED ALERT
Never say never.
The trick is to do this:
Original BC struct fwritten:
struct Thing {
char name[40];
int x;
long int y;
short int z;
};
Long and Short ints are the same in DJGPP as BC.
BCC Ints are the same as Short Ints, DJGPP Ints are the same as Long
Ints.
DJGPP pads structures for a Technical Reason, which must be disabled.
DJGPP version of the struct to fread from the file:
#pragma pack(1)
struct Thing {
char name[40];
short int x; //The only change
long int y; //could be written just "int y"
short int z;
};
#pragma pack()
Tada! A SHARED BINARY FILE!
Regards,
ABW
--
I have become... Comfortably numb...
Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk
<A HREF="http://www.hardcafe.co.uk/Alaric/">http://www.hardcafe.co.uk/Alaric/</A>
- Raw text -