Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cwjcc!gatech!mcnc!rti!xyzzy!tiktok!meissner From: meissner@tiktok.dg.com (Michael Meissner) Newsgroups: comp.lang.c Subject: Re: Does NEWLINE always flush stdio buffer? Message-ID: <7796@xyzzy.UUCP> Date: 16 Jul 89 14:08:55 GMT References: <11012@ihlpl.ATT.COM> <12375@bloom-beacon.MIT.EDU> <10487@smoke.BRL.MIL> <4861@ficc.uu.net> Sender: usenet@xyzzy.UUCP Reply-To: meissner@tiktok.UUCP (Michael Meissner) Organization: Data General (Languages @ Research Triangle Park, NC.) Lines: 18 In article <4861@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes: | No, it is not. In fact, if (popping down to the implementations I'm familiar | with) _filbuf(stdin) calls _flsbuf(stdout) you get all the advantages of | line-buffered output, obviate the need for most explicit fflush() calls, and | have almost no overhead. This behaviour was first implemented (to my | knowledge) in the Berkeley stdio library, and is (I believe) what the dpANS | is referring to. | | In fact, if you implement smart flushing, you can abandon the overhead of | line buffering completely, without breaking any working programs. This is not completely true. I've run into programs, which use stdio for output, and raw read's for input. In this case, the output is NOT flushed. -- Michael Meissner, Data General. Uucp: ...!mcnc!rti!xyzzy!meissner If compiles were much Internet: meissner@dg-rtp.DG.COM faster, when would we Old Internet: meissner%dg-rtp.DG.COM@relay.cs.net have time for netnews?