Mail Archives: djgpp/1996/09/03/19:52:08
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: <this space for rent> |
--------------------------------------------------------------------------
- Raw text -