remove

OS/161 Reference Manual

Name

remove - delete (unlink) a file

Library

Standard C Library (libc, -lc)

Synopsis

#include <unistd.h>

int
remove(const char *pathname);

Description

The name of the file referred to by pathname is removed from the filesystem. The actual file itself is not removed until no further references to it exist, whether those references are on disk or in memory.

It is an error for pathname to not specify an existing file or to refer to a directory.

Return Values

On success, remove returns 0. On error, -1 is returned, and errno is set according to the error encountered.

Errors

The following error codes should be returned under the conditions given. Other error codes may be returned for other errors not mentioned here.
  
ENODEV The device prefix of filename did not exist.
ENOTDIR A non-final component of pathname was not a directory.
EISDIR pathname referred to a directory.
ENOENT The target file did not exist.
EIO A hard I/O error occurred.
EFAULT pathname was an invalid pointer.