Thursday, 17 July 2014

C program to delete the given file from the disk

/* C program to delete the given file from the disk */


#include<stdio.h>
#include<conio.h>

void main()
{
   int flag;
   char fn[50];
   clrscr();
   printf("Enter the file name to delete along with extension and path: ");
   gets(fn);
   flag=remove(fn);
   if(flag==0)
printf("%s deleted successfully!\a\a\a",fn);
   else
printf("\nError! Invalid file name\n");
   getch();
}

No comments:

Post a Comment