DeleteFile

  BOOL DeleteFile(lpszFileName)    
  LPTSTR lpszFileName; /* file to delete */

The DeleteFile function deletes an existing file.

Parameters

lpszFileName

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

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

DeleteFile will fail if an application attempts to delete an open file or a file that does not exist. Use the CloseHandle function to close an open file.

The DeleteFile function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).

See Also

CreateFile, CloseHandle