🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1536

Re: Output redirection

#1536
From: Paul John Falstad
Date: Fri, 19 Oct 1990 03:37
25 lines
1368 bytes
In article <4859@graphite20.UUCP> joshi@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@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.
Technical Details
Message-ID: <3447@idunno.Princeton.EDU>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rutgers!njin!princeton!phoenix.Princeton.EDU!pfalstad
References: <4859@graphite20.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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