www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/07/19:05:42

Xref: news2.mv.net comp.os.msdos.djgpp:4709
From: lehmann AT mathematik DOT th-darmstadt DOT de (Alexander Lehmann)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: bmp file format
Date: 7 Jun 1996 14:56:35 GMT
Organization: Technische Hochschule Darmstadt
Lines: 26
Message-ID: <4p9fv3$e60@rs18.hrz.th-darmstadt.de>
References: <9606071033 DOT AA21600 AT slater DOT chemie DOT uni-bremen DOT de>
NNTP-Posting-Host: fb0410.mathematik.th-darmstadt.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


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