Monday, 31 August 2015

C Program to delete a file.

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
 int status;
 char name[25];
 clrscr();
 printf("Enter the name of file you want to delete\n");
 gets(name);
 status=remove(name);
 if(status==0)
 {
   printf("%s file deleted successfully.\n",name);
 } 
 else
 {
   printf("Unable to delete the file\n");
 }
 getch();
}

Output

Leave a Reply

 
 

Labels

Blog Archive