www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2002/03/04/01:23:09

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-workers-bounces using -f
Date: Mon, 4 Mar 2002 08:22:04 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp-workers AT delorie DOT com
Subject: Re: Malloc/free DJGPP code
In-Reply-To: <3C82C4F7.20E7F821@yahoo.com>
Message-ID: <Pine.SUN.3.91.1020304081933.6398G-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 3 Mar 2002, CBFalconer wrote:

> I am getting debug access to things to allow diagnostic software
> to interface cleanly, and I am finding anamolies between fwrites
> (from the application) to stdout (the stream), and writes to
> STDOUT (the handle) from the internal debugging code.  Causes
> great confusion. I would much prefer things to appear in the order
> written :-)

Why do you need to mix fwrite and write?  Why not use write alone?

Actually, for a library function I'd suggest _write instead of write, 
both for leaner footprint and to avoid polluting the ANSI namespace 
with non-ANSI functions.

> Even though the fwrites (or printfs etc) have \n terminators, the
> only way I have found to get it out on the screen before the later
> handle writes is to use an extra fflush.
> 
> Are there any known rules for this sort of stuff?

You must use fflush if you have to mix buffered and unbuffered I/O.  But 
it's best to avoid mixing them altogether.

- Raw text -


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