Deletes the specified file.
Include
<stdio.h>
Prototype
int remove(const char * filename);
Argument
filename |
Return Value
Returns 0 if successful; otherwise, returns -1.
Remarks
If the file represented by filename
does not exist or is
open, remove will fail.
Example
#include <stdio.h>
int main(void)
{
if (remove("myfile.txt") != 0)
printf("Cannot remove file");
else
printf("File removed");
}
Example Output
File removed