remove() - I/O Function
How is remove() used in C++?
Explanation
remove() is an I/O function which is used to remove a file directly without using streams. When a file is successfully deleted, a zero value is returned otherwise a nonzero value is returned. The corresponding errno variable is set to the corresponding error code.
Syntax:
int remove ( const char * filename );
Example :
#include <stdio.h> int main () { remove("removeeg.txt"); return 0; } |
In the above example the rewind() is used to read the information printed into a file by moving the pointer to start of the stream.