Name
remove - Deletes a file.
Syntax
#include <stdio.h>
#include <io.h>
int remove(path)
const char *path;
Description
The remove function deletes the file specified by path.
Return Value
The function returns 0 if the file is successfully deleted.
Otherwise, it returns -1 and sets errno to one of these
values:
Value Meaning
EACCES Path name specifies a directory or a read-only file
ENOENT File or path name not found
See Also
close(S), unlink(DOS)
Example
#include <stdio.h>
main() {
if (remove("data") == -1)
perror("Could not delete 'data'");
else
printf("'data' was successfully deleted\n");
}
This program uses remove to delete a file named data.
(printed 6/18/89)