delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/04/10/01:04:52

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Sun, 10 Apr 2005 07:58:25 +0300
From: "Eli Zaretskii" <eliz AT gnu DOT org>
Sender: halo1 AT zahav DOT net DOT il
To: djgpp AT delorie DOT com
Message-ID: <01c53d8a$Blat.v2.4$12fbcc00@zahav.net.il>
X-Mailer: emacs 22.0.50 (via feedmail 8 I) and Blat ver 2.4
In-reply-to: <129.5a9df4a1.2f89aa98@cs.com> (KTrumpetsRule@cs.com)
Subject: Re: problem with saving struct to disk
References: <129 DOT 5a9df4a1 DOT 2f89aa98 AT cs DOT com>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: KTrumpetsRule AT cs DOT com
> Date: Sat, 9 Apr 2005 18:00:56 EDT
> 
> I'm having a problem saving a struct to disk using DJGPP.  Normally I'd think 
> the problem was me but in view of the fact that it works under SOME 
> circumstances, I'm not sure.  Here's the details.
> [...]
>     ptr_file = fopen(filename, "w");

You should use binary I/O for this, since the struct may include
arbitrary bit patterns.  Instead of "w" use "wb".

>     ptr_file = fopen(filename, "r");

Same here: use "rb", not "r".

- Raw text -


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