REMOVE(3) Library Functions Manual REMOVE(3)

removeremove a file

#include <stdio.h>

int remove(const char *path);

[CX] The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional. This volume of IEEE Std 1003.1-2001 (“POSIX.1”) defers to the ISO C standard.

The remove () function shall cause the file named by the pathname pointed to by path to be no longer accessible by that name. A subsequent attempt to open that file using that name shall fail, unless it is created anew.

If path names a directory, remove ( path) shall be equivalent to ( path).

[CX] Refer to rmdir(3) or unlink(3).

[CX] Refer to rmdir(3) or unlink(3).

The following example shows how to remove access to a file named .

#include <stdio.h>


int status;
...
status = remove("/home/cnd/old_mods");

None.

None.

None.

rmdir(3), unlink(3), the Base Definitions volume of IEEE Std 1003.1-2001 (“POSIX.1”), <stdio.h>

First released in Issue 3. Included for alignment with the POSIX.1-1988 standard and the ISO C standard.

Extensions beyond the ISO C standard are marked.

The following new requirements on POSIX implementations derive from alignment with the Single UNIX Specification:

  • The DESCRIPTION, RETURN VALUE, and ERRORS sections are updated so that if path is not a directory, remove () is equivalent to unlink(3), and if it is a directory, it is equivalent to rmdir(3).

footer end

January 1, 2004 posix.fail