The function remove (), as the name suggests, is used to erase a file. The prototype of remove () as given in Hove () stdio.h can be given as int remove (const char *filename);The remove() will erase the file specified by filename.
REMOVE
()
The
function remove (), as the name suggests, is used to erase a file. The
prototype of remove () as given in Hove () stdio.h can be given as
int remove (const char *filename);
The
remove() will erase the file specified by filename. On success, the function
will return zero and in case of error, it will return a non-zero value.
If
filename specifies a directory, then remove (filename) is the equivalent of
rmdir (filename). Otherwise, if filename specifies the name of a file then
remove (filename) is the equivalent of unlink (filename). Look at the program
given below which deletes the file "temp.txt" from the current
directory.
#include <stdio.h>
main()
{
remove ("temp.txt");
return 0;
}
Note
You
may specify the path of the file which has to be deleted as the argument of
remove () .
Programming in C: Unit V: File processing : Tag: : Syntax with Example C Program - Remove()
Programming in C
CS3251 2nd Semester CSE Dept 2021 | Regulation | 2nd Semester CSE Dept 2021 Regulation
Professional English II
HS3251 2nd Semester 2021 Regulation | 2nd Semester Common to all Dept 2021 Regulation
Statistics and Numerical Methods
MA3251 2nd Semester 2021 Regulation M2 Engineering Mathematics 2 | 2nd Semester Common to all Dept 2021 Regulation
Engineering Graphics
GE3251 eg 2nd semester | 2021 Regulation | 2nd Semester Common to all Dept 2021 Regulation
Physics for Electrical Engineering
PH3202 2nd Semester 2021 Regulation | 2nd Semester EEE Dept 2021 Regulation
Basic Civil and Mechanical Engineering
BE3255 2nd Semester 2021 Regulation | 2nd Semester EEE Dept 2021 Regulation
Electric Circuit Analysis
EE3251 2nd Semester 2021 Regulation | 2nd Semester EEE Dept 2021 Regulation
Physics for Electronics Engineering
PH3254 - Physics II - 2nd Semester - ECE Department - 2021 Regulation | 2nd Semester ECE Dept 2021 Regulation
Electrical and Instrumentation Engineering
BE3254 - 2nd Semester - ECE Dept - 2021 Regulation | 2nd Semester ECE Dept 2021 Regulation
Circuit Analysis
EC3251 - 2nd Semester - ECE Dept - 2021 Regulation | 2nd Semester ECE Dept 2021 Regulation
Materials Science
PH3251 2nd semester Mechanical Dept | 2021 Regulation | 2nd Semester Mechanical Dept 2021 Regulation
Basic Electrical and Electronics Engineering
BE3251 2nd semester Mechanical Dept | 2021 Regulation | 2nd Semester Mechanical Dept 2021 Regulation
Physics for Civil Engineering
PH3201 2021 Regulation | 2nd Semester Civil Dept 2021 Regulation
Basic Electrical, Electronics and Instrumentation Engineering
BE3252 2021 Regulation | 2nd Semester Civil Dept 2021 Regulation
Physics for Information Science
PH3256 2nd Semester CSE Dept | 2021 Regulation | 2nd Semester CSE Dept 2021 Regulation
Basic Electrical and Electronics Engineering
BE3251 2nd Semester CSE Dept 2021 | Regulation | 2nd Semester CSE Dept 2021 Regulation
Programming in C
CS3251 2nd Semester CSE Dept 2021 | Regulation | 2nd Semester CSE Dept 2021 Regulation