stdio.h header file defines the rename() function in C int rename(const char * oldname, const char * newname); rename() method in C int rename(const char * oldname, const char * newname); rename() function in C int rename(const char * oldname, const char * newname); rename() It changes the name of a file or folder from oldname to newname. Because the rename and move operations are the same, you can use this function to move a file.
int rename(const char * oldname, const char * newname);
It takes two parameters, oldname and newname, both of which are pointers to constant characters that define the file's old and new names.
If the file was properly renamed, it returns zero; otherwise, it returns a non-zero integer. If a file with the same name already exists, the rename action replaces the existing file.