Reputation: 1444
During a lengthy and possibly system stressful operation I update a file from time to time via a File Handle and WriteFile
I noticed that when I right mouse click the file and ask for its properties in Windows I don't see it has been updated at all. The Modified time/data doesn't reflect the actual update I did.
I realize that Windows may buffer the content in memory until the file handle is closed. The whole idea is to update the file, so that when the system crashes we at least know where we got (sort of).
How do I make sure the content gets flushed without closing the file handle ?
Upvotes: 0
Views: 2353
Reputation: 6068
I recommend you either try flushing the buffer or check whether WriteFile
is returning TRUE. If it's not, there's probably something wrong, like permission denied or something. You can use GetLastError for that.
Upvotes: 1