This section illustrates you to delete a file in C. You can see in the given
example that we want to remove the file HELLO.txt. For this, we have used
the library function remove() which deletes the file HELLO.txt. In case if the
file will not be deleted, the function perror() prints the error message on
Here i am using TurboC++ IDE and my source file is in the C:\TC\BIN directory and the file to be deleted Hello.txt should be first placed inside the same bin directory.
Here is the code:
When you run the above example, the file HELLO.txt gets removed.
Liked it! Share this Tutorial