Xref: news2.mv.net comp.os.msdos.djgpp:6705 From: alaric AT abwillms DOT demon DOT co DOT uk (Alaric B. Williams) Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP v2 Date: Tue, 30 Jul 1996 17:11:52 GMT Lines: 50 Message-ID: <838746602.16082.5@abwillms.demon.co.uk> References: <31FC7D41 DOT 4E74 AT dsys DOT ceng DOT cea DOT fr> NNTP-Posting-Host: abwillms.demon.co.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Eric NICOLAS 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 http://www.hardcafe.co.uk/Alaric/