From: Andrew Cottrell Newsgroups: comp.os.msdos.djgpp Subject: Re: struct problem Date: Wed, 08 Jan 2003 20:15:04 +1100 Organization: ECLiPSE Lines: 21 Message-ID: <4kqn1v4c7vh7enisg8pv3epde5ra7bnk48@4ax.com> References: <4beb6242eec71f0c5cf10defc2e78b1d DOT 62691 AT mygate DOT mailgate DOT org> NNTP-Posting-Host: p777-apx1.syd.ihug.com.au Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: lust.ihug.co.nz 1042017304 32037 203.173.143.15 (8 Jan 2003 09:15:04 GMT) X-Complaints-To: abuse AT ihug DOT co DOT nz NNTP-Posting-Date: Wed, 8 Jan 2003 09:15:04 +0000 (UTC) X-Newsreader: Forte Agent 1.92/32.572 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com >In writting a simple bmp loader, I'm having problems with the struct for >the bmp header. Even with __attribute__((__packed__)) after each item: ..SNIP.. >To load the bmp header, I'm using fread (if that makes any difference). >And the program is using C, not CPP files (if that also, makes any >difference.) >Any help is appreciated. Thanks. Have a read of the FAQ in the FAQ directory for sections 22.11 and 22.12 as they will help. I use the #pragma pack() as it then works for C or C++. BTW Go and have a look at Allegro, http://alleg.sourceforge.net/ as it has BMP support and when I added BMP support a long long time ago to one of m,y programs (before allegro came along) the BMP specs from MS are a bit confusing as there were some tricks. To save you pulling out your hair have a look at the code in Allegro and remember that Allegro works on DOS, Windows and Linux so it may make your application more portable if you use it. Andrew