Mail Archives: djgpp-workers/2002/03/04/01:23:09
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 -