- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C program to delete a file
In programming, working with files is very important and every programming language has its own set of functions or library that help in manipulation of files.
In C Programming Language also there is a function remove which can be used by the programmer to delete a file.
remove() function in c programming
The remove function is used to delete the file whose name is specified. This function is in the stdio header file.
Syntax
remove (“file_name”);
Parameters
The function accepts one parameter which is the name of the file that is to be deleted.
File name can also be the path to the file but only if the system supports it.
return value
It returns zero, if the deletion operation is successfully completed. otherwise a non zero return on failure.
Example
#include<stdio.h> int main() { int del = remove("textFile.txt"); if (!del) printf("The file is Deleted successfully"); else printf("the file is not Deleted"); return 0; }
Output
The file is Deleted successfully
- Related Articles
- Delete a file in C#
- Java program to delete certain text from a file
- Java Program to delete file or directory
- Java Program to delete a file or directory when the program ends
- Java program to delete duplicate lines in text file
- How to delete a file using Python?
- C# Program to rename a file
- How to delete a temporary file in Java?
- Write a program to Delete a Tree in C programming
- C# Program to get information about a file
- C Program to find size of a File
- C Program to delete n characters in a given string
- How to delete a string inside a file(.txt) in java?
- C# Program to write an array to a file
- How do I delete a file in Python?

Advertisements