delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/23/04:14:22

Date: Thu, 23 Dec 1999 09:39:01 +0200 (WET)
From: Andris Pavenis <pavenis AT lanet DOT lv>
To: Ghalos <greg AT holdridge7 DOT freeserve DOT co DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Structure padding
In-Reply-To: <83rc56$ppp$1@news6.svr.pol.co.uk>
Message-ID: <Pine.A41.4.05.9912230936550.85136-100000@ieva01.lanet.lv>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com


On Wed, 22 Dec 1999, Ghalos wrote:

> I have a problem loading the header for an FLI file.... it should be 128
> bytes like this:
> 

#pragma pack(1)

> struct fli_file_header_s
> {
>    int  size;
>    short magic;
>    short frames;
>    short width;
>    short height;
>    short depth;
>    int  flags;
>    short speed;
>    int  next;
>    int  frit;
>    char  expand[100];
> }

#pragma pack()

> 
> Problem is.... DJGPP pads this out to take up 132 bytes! I guess this is to
> keep everything nicely aligned but I can't read it in from the file
> correctly if this happens... how can I stop it??
> 

Using #pragma pack(1) and #pragma pack() is one (but not only) of the 
ways how to do that

- Raw text -


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