delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/01/08/06:40:41

From: Andrew Cottrell <andnews AT ihug DOT com DOT oz DOT au>
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
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019