rename

Full prototype:

int rename(const char*, const char*);  

Purpose and Notes:

Moves or changes the name of a file.

Changes the filename passed in as the first argument to that of the second argument. Any future attempts to open the file must use the new name as the old one will no longer work.

It is implementation-defined on what will happen if you rename a file to an already existing file name.

Returns:

int- Returns zero on sucess and non-zero on failure. (On failure the file will still be named as if there was no call to the rename function)

Argument 1:

const char*- A string that corresponds to an absolute or relative path to a file who's name or location you want to change.

Argument 2:

const char*- A string that corresponds to an absolute or relative path to where and what you want the new file to be named.

Example 1