Xref: news2.mv.net comp.os.msdos.djgpp:8238 From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: interrupting with ctrl-C Date: Tue, 03 Sep 1996 18:44:09 -0700 Organization: Three pounds of chaos and a pinch of salt Lines: 31 Message-ID: <322CDEE9.1241@cs.com> References: <50i9ub$qv5 AT mark DOT ucdavis DOT edu> NNTP-Posting-Host: ppp204.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Jeffrey Taylor wrote: > > Eli Zaretskii (eliz AT is DOT elta DOT co DOT il) wrote: > : `fflush' is not enough when redirection is used, or when you invoke a > : child program that reads from a file written by the parent. You should > : either close the file or call `fsync' to ensure DOS flushes its buffers. > : `fflush' only flushes the DJGPP buffers, but not the DOS ones. > > If you are using SMARTDRV, its buffers need to be flushed too. Off the > top of my head, I would spawn a call to run "smartdrv /c" What, every time you write to the file? You'd completely bog down your program! Even if it crashes, as long as it returns to the DOS prompt, SMARTDRV writes all the data. Of course, this doesn't apply in the case of hard crashes, but how safe do you need to get?! Also, unless I miss my guess, calling SMARTDRV causes it to be loaded if it is not already-- do you really want to do this to some unsuspecting user? P.S.: If you really, really, REALLY want to be safe, turn off SMARTDRV's write caching, either manually before you run the program or via a spawn when the program starts up. The switch to turn off all write caching is "/x". John -- -------------------------------------------------------------------------- | John M. Aldrich, aka Fighteer I | fighteer AT cs DOT com | | Plan: To find ANYONE willing to | http://www.cs.com/fighteer | | play Descent 2 on DWANGO! | Tagline: | --------------------------------------------------------------------------