Date: Wed, 16 Jun 1999 10:45:36 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: "Andrew R. Gillett" cc: djgpp AT delorie DOT com Subject: Re: Log file and Win98 caching In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Wed, 16 Jun 1999, Andrew R. Gillett wrote: > In comp.os.msdos.djgpp, Pavlos wrote: > > >is there any way I can make it so that it creates the > > >file as soon as I call fopen, and writes to the file as soon as I call > > >fprintf? > > > > Maybe fflush() can help you > > Didn't make any difference. Try "fsync(fileno(f));", where f is the FILE object for the log file. The call to `fsync' should be IN ADDITION to `fflush', not *instead* of it. If that doesn't work, you can call `sync' at strategic places. This will cause the disk cache to flush all its buffers to the disk, but it will also slow down your program tremendously, so it is probably impractical to plug it after every fflush. If `sync' doesn't help either, then your program is crashing so quickly and violently that the disk caching is not what prevents the data from being written to disk.