Node:Deleting Files, Next:Renaming Files, Previous:Symbolic Links, Up:File System Interface
You can delete a file with unlink
or remove
.
Deletion actually deletes a file name. If this is the file's only name, then the file is deleted as well. If the file has other remaining names (see Hard Links), it remains accessible under those names.
int unlink (const char *filename) | Function |
The unlink function deletes the file name filename. If
this is a file's sole name, the file itself is also deleted. (Actually,
if any process has the file open when this happens, deletion is
postponed until all processes have closed the file.)
The function This function returns
|
int rmdir (const char *filename) | Function |
The rmdir function deletes a directory. The directory must be
empty before it can be removed; in other words, it can only contain
entries for . and .. .
In most other respects,
These two error codes are synonymous; some systems use one, and some use
the other. The GNU system always uses The prototype for this function is declared in the header file
|
int remove (const char *filename) | Function |
This is the ISO C function to remove a file. It works like
unlink for files and like rmdir for directories.
remove is declared in stdio.h .
|