Date: Mon, 15 Sep 1997 14:37:13 +0300 (IDT) From: Eli Zaretskii To: Nate Eldredge cc: Paul Derbyshire , 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: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.)