rename function(Rename File) in C Language – example and detail

In the C Programming Language, the rename feature adjustments the identify of a file. You must close the file earlier than renaming, as a file can not be renamed if it is open.


The syntax for the rename characteristic in the C Language is:

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

Parameters or Arguments

old The ancient file title that will be changed. new The new file identify to use.


The rename characteristic returns zero is successful, otherwise nonzero.

Required Header

In the C Language, the required header for the rename feature is:

#include <stdio.h>

Applies To

In the C Language, the rename characteristic 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:

remove function <stdio.h>