I have a program that basically does this
while(1)
FindFirstFile()
if file found
CreateFile()
DeleteFile()
However, sometimes CreateFile reports ERROR_FILE_NOT_FOUND, even though FindFirstFile found a file! Does DeleteFile guarantee that the file won't show up in directory listings after it returns?
You may be running into the issue described by Raymond Chen in his blog.
Basically, DeleteFile()
is "kind of" asynchronous - if the file you are deleting has any outstanding file handles on it, the file system simply marks the file as "to be deleted", but it doesn't actually disappear from the directory listing until the last open handle to it is closed - even though DeleteFile
returns success.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With