Delete a file : File Delete « File « C / ANSI-C






Delete a file

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

int main(void)
{
  char fname[80];

  printf("Enter name of file to delete: ");
  gets(fname);
 
  printf("Are you sure? (Y/N) ");
 
  if(toupper(getchar())=='Y') 
      remove(fname);

  return 0;
}


           
       








Related examples in the same category

1.Delete file
2.Delete file 2
3. Delete a file: how to use remove