Flush file write buffer?

mjcoon

Well-Known Member
Licensed User
I wanted to include the ability to make a copy of a file that the program had just been writing (so that one file could be terminated immediately while the other was retained for completion later).

I wasn't sure whether the CopyFile() would work while the source file is still open for writing but it does. However the file is not complete; I suspect that some of the last few file writes have been buffered and not written to the file and thus do not get copied.

If I close the file and re-open it (for appending this time) then the copy works fine.

Could there be a flush function, say FileFlush(), to ensure the final buffer-full is written?

BTW the help for FileOpen() should not describe the cWrite option as meaning "write-only" when it goes on to say that it permits read functions.

Mike.
 
Top