remove()

remove file 

Function


SYNOPSIS

#include <stdio.h>

int remove(const char *path);


DESCRIPTION

remove() 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 fails, unless the file is created anew.

If path does not name a directory, remove(path) is equivalent to unlink(path).

If path names a directory, remove(path) is equivalent to rmdir(path).


PARAMETERS

path 

Points to the file or empty directory to be removed.


RETURN VALUES

Returns 0 on success. On failure, returns -1 and errno is set to one of the following:

EACCES 

Search permission is denied on a component of the path prefix.

Write permission is denied on the directory that contains the path to be removed.

EBUSY 

The path to be removed is currently in use by the system or another process or the directory to be removed is the current directory of some process.

EEXIST 

path names a directory that is not empty; the directory contains entries other than those for dot (.) and dot-dot (..).

EFAULT 

path is an invalid pointer.

ENAMETOOLONG 

The length of the path parameter exceeds PATH_MAX or a path component is longer than NAME_MAX.

ENOENT 

path names a nonexistent file or directory or points to an empty string.

ENOLINK 

path points to a remote machine, and the link to that machine is no longer active.


CONFORMANCE

ANSI/ISO 9899-1990.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

8.1/2012R2/10/2016/2019/11/2022 does not let you delete a directory if a user has a lock on it. Any user that is in that directory has a lock on it. All locks to a directory must be resolved before remove() on a directory can be successful.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
rmdir(), unlink()


PTC MKS Toolkit 10.4 Documentation Build 39.