DeleteFile will also fail if the file is open.
It is fairly easy when debugging to end up with a copy of your program running in the background. In that case the file may still be in use even though you think you have closed it.
It is fairly easy when debugging to end up with a copy of your program running in the background. In that case the file may still be in use even though you think you have closed it.