This function is compatible with the following targets:
|
EMB/RTOS
|
|
#include <stdio.h>
int remove(const char *filename);Parameters:
Parameters for this facility are:
The remove() function deletes the named file specified by filename.
remove() returns 0 if the file deletion is successful, and returns a nonzero value if it fails.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char filename[40];
// get a filename from the user
printf("Enter the name of the file to delete.\n");
gets(filename);
// delete the file
if (remove(filename) != 0) {
printf("Can't remove %s.\n", filename);
exit(1);
}
return 0;
}