Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!wuarchive!mailrus!ncar!tank!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: How to flush output (was how ... to disk) Message-ID: <21184@mimsy.umd.edu> Date: 8 Dec 89 18:10:03 GMT References: <606@caldwr.UUCP> <1025@friar-taac.UUCP> <4176@sbcs.sunysb.edu> <333@charyb.COM> Distribution: usa Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 15 In article <333@charyb.COM> dan@charyb.COM (Dan Mick) writes: >fflush()? You've gotta do that more than once. Why not add a >setbuf(stdout, NULL) to the top of the file? Quick, easy, simple. ... and slow. I mean *really* slow. I mean, really truly HORRIBLY slow. I mean, if you think the city buses are slow. . . . Why not, instead, add a `setvbuf(stdout, (char *)NULL, _IOFBF)' to main, and then (since tty output will no longer be line buffered, being efficient instead) add fflush() calls whenever you want the output to be visible? I have done it; it is not hard; it makes programs that produce much output go much faster. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris