remove directory entry

View versions (4)

INTERFACE

#include <stdio.h>
int remove ( const char *path )

DESCRIPTION

The remove function removes the file or directory specified by path.

If path specifies a directory, remove(path) is the equivalent of rmdir(path). Otherwise, it is the equivalent of unlink(path).

The following example attempts to delete the file "fred.txt" from the current directory.

Example 1
Workings
#include <stdio.h>
int main()
{
  remove("fred.txt");
  return 0;
}

ERRORS

The remove function may fail and set errno for any of the errors specified for the routines lstat, rmdir or unlink.

See Also

system