Subj : Committing file changes
To   : CORIDON HENSHAW
From : MIKE RUSKAI
Date : Sun Aug 13 2000 10:49 am

Some senseless babbling from Coridon Henshaw to All
on 08-11-00  23:38 about Committing file changes...

CH> What's the proper way to 'checkpoint' an open file so as to ensure
CH> that the file's control structures are consistant on disk?  I would
CH> have thought that calling fflush() after every file write would be
CH> sufficient, but a recent trap proved that calling fflush() after file
CH> writes was no protection against CHKDSK truncating the file well before
CH> the last write.  I suppose I could close and reopen the file after
CH> every update, but I was hoping to find a more elegant solution.  Any
CH> ideas?

I had thought that fflush() would call DosResetBuffer(), but it would seem
that at least some compilers only flush the CRT's buffers.

So, what you'd need to do is get an OS/2 handle to the file, and use
DosResetBuffer() directly.  If you can't get a handle, you can also use
that API to flush all open files for the current process.

That should solve your problem.

Mike Ruskai
[email protected]


... Any problem can be solved by shooting the right person.

___ Blue Wave/QWK v2.20
--- Platinum Xpress/Win/Wildcat5! v3.0pr3
* Origin: Get all your fido mail here.. www.docsplace.org  (1:3603/140)