13.18. remove()

Delete a file

Prototypes

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

Description

Removes the specified file from the filesystem. It just deletes it. Nothing magical. Simply call this function and sacrifice a small chicken and the requested file will be deleted.

Return Value

Returns zero on success, and -1 on error, setting errno.

Example

char *filename = "/home/beej/evidence.txt";

remove(filename);
remove("/disks/d/Windows/system.ini");

See Also

rename()