Mail Archives: djgpp/1999/10/13/13:05:16
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 -