INFO: DeleteFile Fails if File is OpenID: Q225343
|
The Win32 API DeleteFile function fails if an application attempts to delete a file that is open for normal I/O or as a memory-mapped file. This is true for all versions of Windows NT.
In the Windows 95 and 98 environment, the DeleteFile function deletes a file even if it is open unless the file has been opened with the FILE_SHARE_DELETE flag. Because deleting open files may cause loss of data and application failure, make sure to close a file before attempting to delete it.
If the file has been opened with the FILE_SHARE_DELETE flag, the DeleteFile function will succeed, but the file will not actually disappear until the last handle to the file has been closed.
Additional query words: compatguidediff
Keywords : kbWinOS2000 kbGrpKernBase
Version : winnt:
Platform : winnt
Issue type : kbinfo
Last Reviewed: May 25, 1999