C++ File Delete specified by the user.

Description

C++ File Delete specified by the user.

#include <stdio.h>
#include <iostream>
using namespace std;
void main()/*from   w w w  . j a va2 s  . com*/
{
   char filename[12];
   cout << "What is the filename you want me to erase? ";
   cin >> filename;
   if (remove(filename) == -1)
   {
      cout << "\n*** I could not remove the file ***\n";
   }
   else
   {
      cout << "\nThe file " << filename << " is now removed\n";
   }
   return;
}



PreviousNext

Related