delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2013/12/03/07:55:23

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Date: Tue, 03 Dec 2013 14:55:16 +0200
From: Eli Zaretskii <eliz AT gnu DOT org>
Subject: Re: Question about different behavior of fclose/fread on plain dos and windows.
In-reply-to: <529DD111.8050000@gmx.de>
X-012-Sender: halo1 AT inter DOT net DOT il
To: djgpp AT delorie DOT com
Message-id: <83r49u3xhn.fsf@gnu.org>
References: <529D448A DOT 7050208 AT gmx DOT de> <831u1u5se3 DOT fsf AT gnu DOT org> <529DD111 DOT 8050000 AT gmx DOT de>
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

> Date: Tue, 03 Dec 2013 13:39:45 +0100
> From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
> 
> It has no influence if I call clearerr.  The flags that are cleared are not set
> before the call.  It works reliably in all variants if I open the file for reading
> after having closed the write handle.

If you stepped through fread and its subroutines with a debugger, and
saw that _filbuf is actually called, and calls _read (as opposed to
just returning a -1 based on some flag), then I guess what you see is
the difference in the implementation of INT 21h function 3Fh between
the different systems.  Probably DOS records internally the size of
the file when you open a handle for reading, or something similar.

But do be sure that the error indeed comes from _read and not from
some information recorded in the FILE object from before the file is
closed.

- Raw text -


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