Line Buffered output (Re: Is Unix stdio slow?)

Peter da Silva peter at ficc.uu.net
Tue Sep 27 00:28:31 AEST 1988


In article <13733 at mimsy.UUCP>, chris at mimsy.UUCP (Chris Torek) writes:
[ a bunch of stuff including a reference to line buffered output ]

It always depresses me when I think that people are still doing line
buffered output. The problem of handling stdout and stdin is a solved
problem: do a flushbuf on all interactive streams whenever you do a
fillbuf on any interactive stream. This would also make 90% of the explicit
calls to fflush() unnecessary, since most of them are something like:

	printf("Command> ");
	fflush(stdout);
	gets(buffer);

AND it's more efficient since it takes that test out of putchar!
-- 
Peter da Silva  `-_-'  Ferranti International Controls Corporation.
"Have you hugged  U  your wolf today?"            peter at ficc.uu.net



More information about the Comp.unix.wizards mailing list