Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!nuchat!sugar!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: Does NEWLINE always flush stdio buffer? Message-ID: <4920@ficc.uu.net> Date: 9 Jul 89 16:24:23 GMT References: <11012@ihlpl.ATT.COM> <12375@bloom-beacon.MIT.EDU> <10490@smoke.BRL.MIL> Organization: Xenix Support, FICC Lines: 30 In article <10490@smoke.BRL.MIL>, gwyn@smoke.BRL.MIL (Doug Gwyn) writes: > In article <4861@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes: > >>The cost of implementing this can be substantial! > >No, it is not. In fact, if ... _filbuf(stdin) calls _flsbuf(stdout) ... > It is not just stdout, but ALL terminal-associated streams that are > supposed to be flushed. A little odd, but defensible. I don't know if this is a mistake or not, but I'd like to ask how many terminal-associated streams the majority of applications open... > Also, during output it is necessary to check > each character against new-line to implement line buffering. Only if you want to implement line-buffering. Smart buffering (where you flush output buffers when you go to fill input buffers) almost completely removes any need for line buffering, and radically reduces the need for explicit fflush()ing. > I stand by my assessment that line buffering is a mistake. I agree. Line buffering is a mistake. But if you have a look at what I wrote you'll see I didn't advocate line buffering. -- Peter da Silva, Xenix Support, Ferranti International Controls Corporation. Business: peter@ficc.uu.net, +1 713 274 5180. | "WHAT HAPPENED TO ALL Personal: peter@sugar.hackercorp.com. `-_-' | THE WOMEN IN TEXAS?" Quote: Have you hugged your wolf today? 'U` | -- ACS1W@jane.uh.edu (meesh)