Use C remove function to delete a file
Syntax
C remove function has the following syntax.
int remove(const char *fname);
Header
C remove function is from header file stdio.h.
Description
C remove function
deletes file by *fname
.
C remove function returns zero on success or nonzero on error.
Example
Use C remove function to delete a file.
#include <stdio.h>
/*from w w w . ja v a 2 s . c o m*/
int main(int argc, char *argv[])
{
if(remove("test"))
printf("Remove Error");
return 0;
}