Answer: Functions which manipulate files without performing I/O with them are called file manipulation functions. They are prototyped below
int remove(char const *filename); int rename(char const *oldname, char const *newname);
‘remove()’ function can be used to explicitly close/delete a file specified by argument. If the specified file is open while remove() was called, behaviour is implementation defined. ‘rename()’ function can be called to change the name of a file from oldname to newname. If the file with newname is already existing while ‘rename()’ was called, behaviour is implementation defined. Both the functions return ZERO when succeed and non-zero value when they fail. If ‘rename()’ fails, file with original name is yet accessible.
For example, for an existing file “hello.txt”,
remove("hello.txt"); rename("hello.txt", "byebye.txt");
Sanfoundry Global Education & Learning Series – 1000 C Tutorials.
- Get Free Certificate of Merit in C Programming
- Participate in C Programming Certification Contest
- Become a Top Ranker in C Programming
- Take C Programming Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Buy C Books
- Watch Advanced C Programming Videos
- Apply for Computer Science Internship
- Practice Computer Science MCQs
- Buy Computer Science Books