Mail Archives: djgpp/2003/01/08/15:45:18
"Joel Saunders" <jbs30000 AT aol DOT com> wrote in
news:bcd4cba120fadbd18cb606881c88ae87 DOT 62691 AT mygate DOT mailgate DOT org:
> I made a post about this yesterday, but it never showed up, so I'll
> try again, and hope it posts this time.
> For a basic bmp loader I made, the struct to hold the bmp header
> doesn't work. I used __attribute__((__packed__)) after each item, but
> it's no good. I gave the file for the program, a C extention, instead
> of a cpp extention, so I know that probably makes some difference.
> Here's the header...
> struct BMP_Header {
> unsigned int BM __attribute__((__packed__));
> unsigned long File_Size __attribute__((__packed__));
<snip>
> Here's what I had to use instead of the header:
> unsigned char image[54];
> #define image_BM ((int *)&image[0])[0]
> #define image_File_Size ((long *)&image[2])[0]
sizeof int on djgpp is 4, not 2.
--
A. Sinan Unur
asu1 AT c-o-r-n-e-l-l DOT edu
Remove dashes for address
Spam bait: mailto:uce AT ftc DOT gov
- Raw text -