xxxxxxxxxx
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
intstatus;
char fileName[20];
cout<<"Enter the Name of File: ";
cin>>fileName;
status = remove(fileName);
if(status==0)
cout<<"\nFile Deleted Successfully!";
else
cout<<"\nError Occurred!";
cout<<endl;
return 0;
}
xxxxxxxxxx
/* remove example: remove myfile.txt */
#include <stdio.h>
int main ()
{
if( remove( "myfile.txt" ) != 0 )
perror( "Error deleting file" );
else
puts( "File successfully deleted" );
return 0;
}