delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/15/07:40:19

Date: Mon, 15 Sep 1997 14:37:13 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Nate Eldredge <eldredge AT ap DOT net>
cc: Paul Derbyshire <ao950 AT FreeNet DOT Carleton DOT CA>, djgpp AT delorie DOT com,
lchandar AT mindspring DOT com
Subject: Re: Please Help: Printf problem argv[] issues. LFN?
In-Reply-To: <199709141842.LAA12548@adit.ap.net>
Message-ID: <Pine.SUN.3.91.970915143653.22620D-100000@is>
MIME-Version: 1.0

On Sun, 14 Sep 1997, Nate Eldredge wrote:

> At 05:17  9/13/1997 GMT, Paul Derbyshire wrote:
> >
> >Unlike Borland, DJGPP line-buffers stdio. Add fflush(stdout) after the
> >printf's in the loop (or a \n at the end of the line) and all
> >should work.
>
> Not entirely correct... stdout is not line buffered, but fully buffered. And
> the buffer is 4K in size. So adding a \n will not help.

No, Nate, Paul was right: stdout *is* line-buffered *if* it is
connected to the console device.  So if \n is added, it *will* output
the string immediately.  If stdout is redirected to a file or a pipe,
then it is indeed fully buffered, but as far as I can see, the buffer
size is the size of the transfer buffer, not 4K.

(`stdout' is initialized as fully buffered, but the first time it is
actually used, the buffering is changed to line-buffering if it is
connected to a console.  See src/libc/ansi/stdio/flsbuf.c in the
library sources.)

- Raw text -


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