Program to delete a file in C

c_logo







#include<stdio.h>

main()
{
   int status;
   char file_name[25];

   printf("Enter the name of file you wish to deleten");
   gets(file_name);

   status = remove(file_name);

   if( status == 0 )
      printf("%s file deleted successfully.n",file_name);
   else
   {
      printf("Unable to delete the filen");
      perror("Error");
   }

   return 0;
}

Output
Enter the name of file you wish to delete
hello.c
hello.c file deleted successfully.

AdBlock Detected!

Please disable your AdBlocker to access this website.

Once disabled, this message will disappear automatically.