There exists some further functions to manipulate files that can be useful.
The remove
function removes a file given its filename.
int remove(char *filename);
This function returns 0
if success; otherwise, it
returns a nonzero value.
The rename
function changes the name of the file
identified by oldname
to newname
. We have the
possibility to move the file to another directory if we set a path into
the newname
, not just a filename:
int rename(const char *oldname, const char *newname);
This function returns 0
if success; otherwise, it
returns a nonzero value. If it fails for any reason, the original
file is unaffected.