# C program to delete a file

CServer Side ProgrammingProgramming

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
Published on 22-Nov-2019 07:39:50