Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: When to use fflush()? Keywords: fflush Message-ID: <19319@mimsy.UUCP> Date: 30 Aug 89 01:34:21 GMT References: <143@sherpa.uucp> Distribution: na Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 16 In article <143@sherpa.uucp> rac@sherpa.uucp (Roger A. Cornelius) writes: >When should you use fflush()? OR are there any guarantees of >when output buffers are flushed? Output buffers are flushed by normal program exit (via exit() or via return from main()), and, in the proposed C standard, by `fflush((FILE *)NULL);'. Some output buffers (those that are `associated with terminals') are flushed by some kinds of input. The short answer is: Use fflush() whenever you want the output to be visible. Unfortunately, there is no way to simply declare that all stdio buffers should always be fully buffered; the latter would help efficiency, and help remind people to use fflush(). -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris