C examples for stdio.h:remove
function
<cstdio> <stdio.h>
Delete a file
int remove ( const char * filename );
Parameter | Description |
---|---|
filename | C string containing the file name. |
On success, a zero value is returned.
On failure, a nonzero value is returned.
#include <stdio.h> int main ()/* ww w . j a v a 2 s.c om*/ { if( remove( "main.cpp" ) != 0 ) perror( "Error deleting file" ); else puts( "File successfully deleted" ); return 0; }