DeleteFile

This function deletes an existing file from a file system. A remote application interface (RAPI) version of this function exists, and it is named CeDeleteFile.

At a Glance

Header file: Winbase.h
Windows CE versions: 1.0 and later

Syntax

BOOL DeleteFile(LPCTSTR lpFileName);

Parameters

lpFileName

[in] Pointer to a null-terminated string that specifies the file to be deleted.

Return Values

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

If an application attempts to delete a file that does not exist, the DeleteFile function fails.

The DeleteFile function fails if an application attempts to delete a file that is open for normal I/O or as a memory-mapped file.

To close an open file, use the CloseHandle function.

See Also

CloseHandle, CreateFile