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

Ralf Quint freedos.la at gmail.com
Wed Mar 22 02:01:17 CET 2017


On 3/21/2017 11:58 AM, James Richters wrote:
> I have not tried FlushFileBuffers() yet, so I just tried it now,  I am getting the same results.
Well, that is expected, as the issue has nothing to do with your 
program, it's the caching of the operating system that is responsible 
for the actual physical write to the disk.
I see something similar with some text files that I use while doing some 
cross-platform work that I am doing recently.

The actual test file is on a Windows 8.1 machine, while most of the 
access to that file is from either a Windows 10 laptop or a macOS Sierra 
MacBook Pro. Occasionally, more pronounced when one of these two 
machines is connected via WiFi instead of wired connection (on the same 
logical subnet though!), when reloading the file from disk, it shows up 
corrupted on the other machine, while it shows perfectly fine on the one 
that did the last write. Force a new write and in 99.9% of all cases, it 
will show up just fine on another reload...

Any chance that the file(s) you are working with are on a shared drive?

Ralf

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus




More information about the fpc-pascal mailing list