cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/03/20:58:32

From: "Michael Stewart" <mike AT reggin DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: what is _attribute_((packed)) ?? why DJGPP use it?
Date: Tue, 3 Aug 1999 14:00:10 +0100
Organization: (Posted via) Netcom Internet Ltd.
Lines: 27
Message-ID: <7o6p4n$7u3$1@taliesin.netcom.net.uk>
References: <7o5doq$gj8$1 AT nnrp1 DOT deja DOT com> <7o6831$4un$1 AT taliesin DOT netcom DOT net DOT uk> <7o6mf2$btp$1 AT nnrp1 DOT deja DOT com>
NNTP-Posting-Host: hgty.capgemini.co.uk
X-Trace: taliesin.netcom.net.uk 933685207 8131 194.42.240.2 (3 Aug 1999 13:00:07 GMT)
X-Complaints-To: abuse AT corp DOT netcom DOT net DOT uk
NNTP-Posting-Date: 3 Aug 1999 13:00:07 GMT
X-Newsreader: Microsoft Outlook Express 4.72.3155.0
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

zidharta AT geocities DOT com wrote in message <7o6mf2$btp$1 AT nnrp1 DOT deja DOT com>...
>Im going to read the FAQ ... so if you think I can find this easily on
>the FAQ just ignore this ...

The FAQ should be one of the first places to look for information. It's all
indexed and pretty easy to find what you want. Other information can be
found in the Knowledge Base, howto's and , suprisingly enough ;-), the
documentation.


>as far as I know I need __attribute_((packed)) for reading bmp file ...
>is it always needed for reading file ... ?
>or is it only needed when you want to transfer file info into struct
>like when you read BMP file??


When you are reading structures from a file, chances are that you'll need to
use the __attribute__((packed)) extension (note: 2 underscores before and
after the `attribute') to ensure the file is read as you would expect. If
you are just reading a text file (or similar) then you probably won't be
reading the data direct into a structure.

The safest way to read a file (IMHO) would be to read the file as char's and
convert into the required format as needed. I think this would be more
portable (over different compilers as well as different platforms).


- Raw text -


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