www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/24/04:40:37

Date: Sun, 24 Nov 1996 11:28:26 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Faulkner <faulkner AT southcom DOT com DOT au>
Cc: djgpp AT delorie DOT com
Subject: Re: strange file writing/reading problem
In-Reply-To: <3295D2C1.4D5@southcom.com.au>
Message-Id: <Pine.SUN.3.91.961124112555.28870C-100000@is>
Mime-Version: 1.0

On Sat, 23 Nov 1996, Faulkner wrote:

> 	Here's a problem for the DJGPP people of the world.
> I've got 2 structures, a VertexType and a PolygonType, both are simple
> and short structures. I write 20 vertices to a file, then 20 polygons
> to a file. When I read the file back into memory any element that
> has the no. 13 in it goes screwy!!!! (dont worry, I've checked for
> viruses).

You write the file in binary mode (which is correct), but read it in text 
mode (which is incorrect).  Change this line:

        fp=fopen(argv[1], "r");
 
to say this:

        fp=fopen(argv[1], "rb");
 
then try again.

- Raw text -


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