delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/16/07:49:15

Date: Wed, 16 Jun 1999 10:45:36 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: "Andrew R. Gillett" <arg AT whangomatic DOT freeserve DOT co DOT uk>
cc: djgpp AT delorie DOT com
Subject: Re: Log file and Win98 caching
In-Reply-To: <MPG.11d0c254e3bea9a598ada2@news.freeserve.net>
Message-ID: <Pine.SUN.3.91.990616104518.16595O-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019