delete a file
int unlink( const char *path );
The unlink() function deletes the file whose name is the string
pointed to by path. This function is equivalent to the
The unlink() function returns zero if the operation succeeds,
nonzero if it fails, in which case errno is set.
- Search permission is denied for a component of path,
or write permission is denied on the directory containing the link to
- The directory named by the path
argument cannot be unlinked because it is being used by the system or
another process, and the implementation considers this to be an error.
- The argument path exceeds PATH_MAX in
length, or a pathname component is longer than NAME_MAX.
- The named file doesn't exist, or path is an empty string.
- A component of path isn't a directory.
- The file named by path
is a directory, and either the calling process doesn't have the
appropriate privileges, or the implementation prohibits using
unlink() on directories.
- The directory entry to be unlinked resides on a read-only file system.
unlink( "vm.tmp" );