COHERENT manpages
This page displays the COHERENT manpage for remove() [Remove a file].
List of available manpages
Index
remove() -- General Function (libc)
Remove a file
#include <stdio.h>
int
remove(filename)
const char *filename;
remove() breaks the link between between filename and the actual file that
it represents. In effect, it removes a file. Thereafter, any attempt to
use filename to open that file will fail. It is equivalent to the system
call unlink().
remove() will remove a file that is currently open. remove() returns zero
if it could remove filename, and nonzero if it could not.
Example
This example removes the file named on the command line.
#include <stdio.h>
#include <stdlib.h>
main(argc,argv)
int argc, char *argv[])
{
if(argc != 1) {
fprintf(stderr, "usage: remove filename\n");
exit(EXIT_FAILURE);
}
if(remove(argv[1])) {
perror("remove failed");
exit(EXIT_FAILURE);
}
return(EXIT_SUCCESS);
}
See Also
libc,
unlink()
ANSI Standard, §7.9.4.1
POSIX Standard, §8.1






