This c program deletes a file which is entered by the user, the file toward be deleted should be present in the directory in which the executable file regarding this program is present. Extension regarding the file should also be entered, also note that deleted file doesn't go toward recycle bin, remove macro is used toward delete the file. If there is an error in deleting the file then an error will be displayed using perror function.
C programming code:#include
main()
{
int status;
char file_name[25];
printf("Enter the name regarding file you wish toward delete\n");
gets(file_name);
status = remove(file_name);
if( status == 0 )
printf("%s file deleted successfully.\n",file_name);
else
{
printf("Unable toward delete the file\n");
perror("Error");
}
return 0;
}
Delete file program executable.
-->
Title : c program toward delete a file
Description : This c program deletes a file which is entered by the user, the file toward be deleted should be present in the directory in which the execu...
Rating : 5