Stdio buffering question

David Feldman david at linc.cis.upenn.edu
Sat Jun 11 02:37:13 AEST 1988


A self proclaimed novice asked why stderr gets buffered when piped in
Sun 0S 3.3.

Well, I can give an answer based on Ultrix experience.  When piping,
stderr gets buffered so that it may be separated from stdout.  Stdout
goes through the pipe, and when it is closed, the stderr buffer gets flushed
through the pipe.  That is assuming you have redirected stderr through the
pipe also.   This is a documented feature, and I believe it is a csh thing.
I can't remember off hand.  I don't think fflush() will help, especially
if it is done in csh.  One way csh could implement this feature is to
attach stderr to a file and then throw the file down the pipe when stdout
closes.  Any csh hackers know the details on this thing?  I am guessin'.

					Dave Feldman
					david at linc.cis.upenn.edu



More information about the Comp.unix.wizards mailing list