Mail Archives: djgpp/1996/06/07/19:05:42
Mathias Koch (mkoch AT chemie DOT uni-bremen DOT de) wrote:
: I want to write a part of the graphic screen into a .bmp file. I
: changed the variable formats, I have found in a script, from 'DWORD'
: to 'unsigned long' and from 'WORD' to 'unsigned short', which should
: have the same length in bytes.
: I found, that the bytes within the variables are disordered in the
: file and no graphic program can read my bmp files!
: Can anyone help me, to fix this problem?
Common reasons for this are different structure packing conventions
and different endianess. Since BMP uses little endian and so does
djgpp, I would guess that some members of your struct get aligned to
multiples of 4. A way to fix this is to write the individual structure
elements with separate fwrite commands (or even better use an endian
independent variant)
bye, Alexander
--
Alexander Lehmann, | "On the Internet,
alex AT hal DOT rhein-main DOT de (plain, MIME, NeXT) | nobody knows
lehmann AT mathematik DOT th-darmstadt DOT de (plain) | you're a dog."
!!CHANGED!! <URL:http://www.mathematik.th-darmstadt.de/~lehmann/>
- Raw text -