www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/13/13:05:16

Date: Wed, 13 Oct 1999 12:00:43 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Viktor Bresan <vbresan AT jagor DOT srce DOT hr>
cc: djgpp AT delorie DOT com
Subject: Re: Probably newbie question (fread)
In-Reply-To: <pm3A4UJ05kJa092yn@jagor.srce.hr>
Message-ID: <Pine.SUN.3.91.991013120016.16702V@is>
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 12 Oct 1999, Viktor Bresan wrote:

> fread (in which I read in complete struct) doesn't act as I expect.

It is usually a good idea to explain what you expect it to do and what
it actually does.  Don't leave this to our guesswork, because more
often than not we will guess wrong.

> What causes two different behaviors in this program?
> Should I avoid filling complete structs with one fread?

See section 22.10 of the DJGPP FAQ, it might give a hint.  If the
struct was written with a program compiled with another compiler, then
you cannot read it in one call to fread due to alignment.  You need to
read each struct member individually.

- Raw text -


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