dos12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
DosDelete (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_DOSFILEMGR
 
USHORT DosDelete(pszFileName, ulReserved)
PSZ pszFileName;     /* pointer to string specifying pathname */
ULONG ulReserved;    /* must be zero*/
 
The DosDelete function deletes a file.
 
The DosDelete function is a family API function.
 
Parameter    Description
────────────────────────────────────────────────────────────────────────────
 
pszFileName  Points to a null-terminated string that specifies the file to
             be deleted. This string must be a valid MS OS/2 filename and
             must not contain wildcard characters.
 
ulReserved   Specifies a reserved value; must be zero.
 
Return Value
 
The return value is zero if the function is successful. Otherwise, it is an
error value, which may be one of the following:
 
     ERROR_ACCESS_DENIED
     ERROR_FILE_NOT_FOUND
     ERROR_NOT_DOS_DISK
     ERROR_PATH_NOT_FOUND
     ERROR_SHARING_BUFFER_EXCEEDED
     ERROR_SHARING_VIOLATION
 
Comments
 
Read-only files cannot be deleted by using the DosDelete function. The
DosSetFileMode function can be used to change a file's read-only attributes,
making it possible to delete that file.
 
The DosDelete function cannot delete directories; use the DosRmDir function
to delete directories.
 
Example
 
This example calls the DosDelete function to delete the file abc, and
displays a message reporting success or failure:
 
USHORT usError;
usError = DosDelete("abc", 0L);
if (usError)
    VioWrtTTY("abc not deleted\r\n", 21, 0);
else
    VioWrtTTY("abc deleted\r\n", 17, 0);
 
See Also
 
DosRmDir, DosSetFileMode