Go to main content

man pages section 3: Basic Library Functions

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

remove(3C)

Name

remove - remove file

Synopsis

#include <stdio.h>

int remove(const char *path);

Description

The remove() function causes the file or empty directory whose name is the string pointed to by path to be no longer accessible by that name. A subsequent attempt to open that file using that name will fail, unless the file is created anew.

For files, remove() is identical to unlink(). For directories, remove() is identical to rmdir().

See rmdir(2) and unlink(2) for a detailed list of failure conditions.

Return Values

Upon successful completion, remove() returns 0. Otherwise, it returns −1 and sets errno to indicate an error.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Committed
MT-Level
MT-Safe
Standard

See Also

rmdir(2), unlink(2), attributes(7), standards(7)