[fpc-pascal] FreePascal Windows - Force files to write to disk

Henry Vermaak henry.vermaak at gmail.com
Tue Mar 21 16:08:13 CET 2017

On Tue, Mar 21, 2017 at 10:39:23AM -0400, James Richters wrote:
> I am still having this issue.  I've managed to narrow down what is happening
> some.   The problem is my data is not actually being written all the way to
> disk.   I now have a repeatable proven method to reproduce the issue.  Here
> is the sequence.
> In my freepascal console application, I create the file
> Assign file
> Rewrite file
> Writeln file 
> Writeln file
> Writeln file ...
> Flush file

Have you tried using the FlushFileBuffers() Windows API?  Something like


Add "windows" to the uses clause, obviously.


More information about the fpc-pascal mailing list