when to fflush ?

Chuck Karish karish at mindcraft.com
Fri Jun 14 11:23:41 AEST 1991


In article <504 at bally.Bally.COM> siva at bally.Bally.COM (Siva Chelliah) writes:
>   I have a question.  Does seeking to the end of a file causes a flushing
>of the buffer ? In my opinion it should not.
>   Look at the following program.  Even though I write only 5 bytes, 
>when you do a cat on test.out , you see "hello."  Move the sleep(500)
>before fseek , and you won't see it.   It happened on both IBM RT running
>AIX 2.1 and RS 6000 running AIX 3.1.  Please comment.

The system is free to flush the output whenever it finds it
convenient to do so.  If you depend on a particular predictable
flushing strategy, you'll wind up with code that's not at all
portable and which is likely to be broken by future quiet
changes to the system.
-- 

	Chuck Karish		karish at mindcraft.com
	Mindcraft, Inc.		(415) 323-9000



More information about the Comp.unix.aix mailing list