C Language: rename function
(Rename File)
In the C Programming Language, the rename function changes the name of a file. You must close the file before renaming, as a file can not be renamed if it is open.
Syntax
The syntax for the rename function in the C Language is:
int rename(const char *old, const char *new);
Parameters or Arguments
- old
- The old file name that will be changed.
- new
- The new file name to use.
Returns
The rename function returns zero is successful, otherwise nonzero.
Required Header
In the C Language, the required header for the rename function is:
#include <stdio.h>
Applies To
In the C Language, the rename function can be used in the following versions:
- ANSI/ISO 9899-1990
See Also
Other C functions that are noteworthy when dealing with the rename function:
Advertisements