INFO: DeleteFile Fails if File is Open (225343)
The information in this article applies to:
- Microsoft Win32 Application Programming Interface (API), when used with:
- the operating system: Microsoft Windows 2000
This article was previously published under Q225343 This article discusses a Beta release of a Microsoft product. The information in this article is provided as-is and is subject to change without notice.
No formal product support is available from Microsoft for this Beta product. For information about how to obtain support for a Beta release, see the documentation that is included with the Beta product files, or check the Web location from which you downloaded the release. SUMMARY
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.
MORE INFORMATION
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.
Modification Type: | Major | Last Reviewed: | 12/17/2003 |
---|
Keywords: | kbinfo KB225343 |
---|
|