C Programming
Computer Programming

C file handling program to delete a specified file using remove() function



Write C file handling program to delete a specified file using remove() function

\* C file handling program to delete a specified file using remove() function *\

# include < stdio.h >
# include < stdlib.h >
int   main( )
{

char filename[15] ;
int ret = 0 ;
printf("\n Enter the filename to be deleted : ") ;
scanf("%s", filename ) ;

ret = remove(filename) ;

if (ret == 0)
      printf(" File deleted successfully\n") ;
else
      printf(" Unable to delete file %s\n", filename ) ;

return 0 ;

}

Output of Program :

Output of C file handling program to delete a specified file using remove() function