Xref: utzoo comp.lang.c:40078 comp.unix.aix:5740 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!pacbell.com!news.arc.nasa.gov!mindcraft.com!karish From: karish@mindcraft.com (Chuck Karish) Newsgroups: comp.lang.c,comp.unix.aix Subject: Re: when to fflush ? Summary: Who cares? Keywords: fflush , fseek, fwrite Message-ID: <676862622.7541@mindcraft.com> Date: 14 Jun 91 01:23:41 GMT References: <504@bally.Bally.COM> Distribution: usa Organization: Mindcraft, Inc. Lines: 17 In article <504@bally.Bally.COM> siva@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@mindcraft.com Mindcraft, Inc. (415) 323-9000