www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/21/20:24:37

From: fredex AT fcshome DOT stoneham DOT ma DOT us
Message-Id: <199608211633.MAA03385@fcshome.stoneham.ma.us>
Subject: Re: interrupting with ctrl-C
To: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii)
Date: Wed, 21 Aug 1996 12:33:07 -0400 (EDT)
Cc: djgpp AT delorie DOT com
In-Reply-To: <Pine.SUN.3.91.960821095259.336B-100000@is> from "Eli Zaretskii" at Aug 21, 96 09:55:21 am

Thinking furiously, Eli Zaretskii wrote:
> 
> 
> On Mon, 19 Aug 1996, Bruce Foley wrote:
> 
> > As well as the suggestion by Eli, also consider closing
> > your file after each record has been written and then re-opening it.
> > This is because writing to the file is not enough to ensure that it
> > has actually been committed to disk.  Closing the file will ensure
> > this happens.
> 
> You don't need to close a file to make sure all the data is delivered to 
> disk.  Just call `fsync' library function, and it will do the same much 
> quicker (`close' and `open' are very expensive).  Calling `sync' will do 
> the same for all open files.
> 

If you're using the open()/read()/write()/close() family, you should
also be able to dup() the file handle then close the duplicate, which
should cause that particular file to be flushed to disk. I'd expect this
to have a lower impact on system load than a sync() or fsync(), since it
deals with only this one file.

Fred
-- 
-------------------------------------------------------------------------------
 .----    Fred Smith    /                        Office: fred AT computrition DOT com 
( /__  ,__.   __   __ /  __   : /                                 508-663-2524 
 /    /  /   /__) /  /  /__) .+'           Home: fredex AT fcshome DOT stoneham DOT ma DOT us 
/    /  (__ (___ (__(_ (___ / :__                                 617-438-5471 
-------------------------------- Jude 1:24,25 ---------------------------------

- Raw text -


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