DeleteFile

DeleteFile deletes an existing file.

Syntax

BOOL DeleteFile(
    LPCTSTR lpFileName
);

Parameters

lpFileName

Points to a null-terminated string that specifies the file to be deleted.

Return Value

TRUE if the function succeeds, FALSE if the function fails

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.

Requirements

Minimum Supported Version RTX64 2013
Header windows.h
Library Rtx_Rtss.lib

See Also:

CloseHandle

CreateFile