www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/24/04:23:33

Xref: news2.mv.net comp.os.msdos.djgpp:5319 rec.games.programmer:53528
From: Roland Exler <R DOT Exler AT jk DOT uni-linz DOT ac DOT at>
Newsgroups: rec.games.programmer,comp.os.msdos.djgpp
Subject: Re: Help -- Reading PCX Header
Date: Mon, 24 Jun 1996 08:28:37 -0700
Organization: Institute for el. Measurement, University of Linz, Austria
Lines: 39
Message-ID: <31CEB425.6BAE@jk.uni-linz.ac.at>
References: <4ql5is$a37 AT maggie DOT ionsys DOT com>
NNTP-Posting-Host: sensor4.emt.uni-linz.ac.at
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

MCheu wrote:

> Sorry to bother everyone with this, but I've been getting some wierd
> numbers from the following programme.  It's supposed to read the
> header from a pcx file and tell me about it.  The first 4 values from
> the header come through ok (ID, version, encoding, bitdepth), but the
> next 4 (Xmin, Ymin, Xmax, Ymax) are way off. ...

> typedef struct {
>         char ID;  /* PCX id -- usually 10 */
>         char ver; /* version */
>         char encoding;
>         char bitdepth;    /* 8 for 256 colour files */
>         int Xmin, Ymin;
>         int Xmax, Ymax;
>         int Hres;
>         int Vres;
>         unsigned char palette[48];
>         char reserved;
>         char ColourPlanes;
>         int bytesPerLine;
>         int paletteType;
>         char Stuff[58];
>         } pcxHead;

with gcc 'char' is 8 bits, 'short int' 16 bits, 'int' and 'long int' are 32 
bits, so use short int where you want to read 16 bits. I prefere to define BYTE 
as unsigned char and WORD as unsigned short, so the programs are easier to be 
ported to another system.

Roland

+---------------------------------------+---------------------------+
I Roland Exler                          I EMAIL:                    I
I Universitaet Linz                     I R DOT Exler AT jk DOT uni-linz DOT ac DOT at I
I Institut fuer Elektrische Messtechnik I                           I
I Altenbergerstr. 69                    I Phone:                    I
I A-4040 Linz, AUSTRIA                  I + 43 732 2468 9205        I
+---------------------------------------+---------------------------+

- Raw text -


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