HostGator Coupons

Saturday, February 20, 2010

C program which deletes itself

Source Code::::::::
#include <stdio.h>
int main(void)
{
   char file[80];

   /* prompt for file name to delete */
   printf("File to delete: ");
   gets(file);              //Here enter the name of the file to delete,it can be the name of  this file also

   /* delete the file */
   if (remove(file) == 0)
      printf("Removed %s.\n",file);
   else
      perror("remove");

   getch();
   return 0;
}
This program is tested in Turbo c 3

No comments:

Post a Comment

free counters