Output redirection
Paul John Falstad
pfalstad at phoenix.Princeton.EDU
Fri Oct 19 13:37:38 AEST 1990
In article <4859 at graphite20.UUCP> joshi at motcid.UUCP (Abhay B. Joshi) writes:
>#include <stdio.h>
>
>main()
>{
setlinebuf(stdout); /* this should fix it */
> fprintf(stdout,"Some People\n") ;
> fprintf(stderr,"Are In\n") ;
> fprintf(stdout,"Very \n") ;
> fprintf(stderr,"Deep\n") ;
> fprintf(stdout,"Trouble\n") ;
>}
By default, stdout is line buffered when connected to a terminal, and
block buffered otherwise. stderr is always unbuffered, hence the
discrepancy.
I'm sure you have your reasons for wanting this. Apparently they're
beyond me. :-)
--
Paul Falstad, pfalstad at phoenix.princeton.edu PLink:HYPNOS GEnie:P.FALSTAD
And Dinsdale said, "You've been a naughty boy, Clement," and splits me nostrils
open, and saws me leg off, and pulls me liver out. And I said, "My name's not
Clement." And then he loses his temper. And he nails me head to the floor.
More information about the Comp.unix.shell
mailing list