In this program, we are going to share a C program to delete a file from directory. If you are a beginner and want to start learning the C programming, then keep your close attention in this tutorial as I am going to share a C program to delete a file from directory.
We have designed this program for beginners for learning purpose. Copy below c program and execute it with c compiler to see the output of the program.
1 2 3 4 5 6 7 8 9 10 11 | #include<stdio.h> int main() { if (remove("test-file.txt") == 0) printf("Deleted successfully."); else printf("Unable to delete the file"); return 0; } |
Deleted successfully
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.