DeleteFile

This function deletes an existing file from a file system. A RAPI version of this function exists, called CeDeleteFile (RAPI).

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.

Use the RemoveDirectory function to delete a directory.

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 handle, use the CloseHandle function.

DeleteFile cannot be used to delete a database volume until the volume has been disconnected. To disconnect a database volume, use the CeUnmountDBVol function.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Winbase.h.
Link Library: Coredll.lib.

See Also

CeDeleteFile (RAPI) | CeUnmountDBVol | CloseHandle | CreateFile | RemoveDirectory | CeUnmountDBVol

 Last updated on Friday, April 09, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.