REMOVE(3S)REMOVE(3S)NAMEremove - remove directory entry
SYNOPSIS
#include <stdio.h>
int remove(const char *filename);
DESCRIPTION
Remove causes the file whose name is the string pointed to by filename
to be no longer accessible by that name. A subsequent attempt to open
that file using that name will fail, unless it is created anew.
If this is the only name for the file, and no process has the file
open, the contents of the file is removed. If a process has the file
open, this process is deferred until the file is closed.
RETURN VALUE
Remove returns zero if the operation succeeds, nonzero if it fails.
If it fails, errno is set to indicate the cause of the failure.
ERRORS
If any of the following conditions occur, remove sets errno to the
corresponding value:
[ENOTDIR] A component of the path prefix is not a directory.
[EINVAL] The pathname contains a character with the high-order
bit set.
[ENAMETOOLONG] A component of filename exceeds 255 characters, or the
entire filename exceeds 1023 characters. For POSIX
applications these values are given by the constants
{NAME_MAX} and {PATH_MAX}, respectively.
[ENOENT] The named file does not exist.
[EACCES] Search permission is denied for a component of the path
prefix.
[EACCES] Write permission is denied on the directory containing
the link to be removed.
[ELOOP] Too many symbolic links were encountered in translating
the pathname.
[EPERM] The named file is a directory and the effective user ID
of the process is not the super-user.
[EPERM] The directory containing the file is marked sticky, and
neither the containing directory nor the file to be
removed are owned by the effective user ID.
[EBUSY] The entry to be unlinked is the mount point for a
mounted file system.
[EIO] An I/O error occurred while deleting the directory entry
or deallocating the inode.
[EROFS] The named file resides on a read-only file system.
[EFAULT] Path points outside the process's allocated address
space.
SEE ALSOunlink(2)
August 1, 1992 REMOVE(3S)