How to flush output (was how ... to disk)
Chris Torek
chris at mimsy.umd.edu
Sat Dec 9 05:10:03 AEST 1989
In article <333 at charyb.COM> dan at 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 at cs.umd.edu Path: uunet!mimsy!chris
More information about the Comp.unix.questions
mailing list