DeleteFile

int DeleteFile (char fileName[]);

Purpose

Deletes an existing file or a group of existing files.

Note   Windows SDK also contains a DeleteFile function. If you include windows.h and do not include utility.h, you will receive compile errors if you call the DeleteFile function.

Parameters

Input
Name Type Description
fileName string The pathname of the file to delete.

fileName can contain wildcard characters "?" and "*", in which case DeleteFile deletes all matching files.

If you specify an empty string "", DeleteFile deletes the file found by the most recent call to GetFirstFile or GetNextFile.

Return Value

Name Type Description
result integer Result of the delete operation.

Code Description
0 Success.
-1 File not found or directory in path not found.
-3 General I/O error occurred.
-4 Insufficient memory to complete operation.
-5 Invalid path; for example, c:filename.
-6 Access denied.
-7 Specified path is a directory, not a file.