Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!njin!princeton!phoenix.Princeton.EDU!pfalstad From: pfalstad@phoenix.Princeton.EDU (Paul John Falstad) Newsgroups: comp.unix.shell Subject: Re: Output redirection Keywords: stderr stdout Message-ID: <3447@idunno.Princeton.EDU> Date: 19 Oct 90 03:37:38 GMT References: <4859@graphite20.UUCP> Sender: news@idunno.Princeton.EDU Organization: Princeton University, Princeton, New Jersey Lines: 25 In article <4859@graphite20.UUCP> joshi@motcid.UUCP (Abhay B. Joshi) writes: >#include > >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@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.