Rename (C)
From Wikipedia, the free encyclopedia
- The correct title of this article is rename (C). The initial letter is shown capitalized due to technical restrictions.
rename is a function in C programming language that renames a certain file. Prototype of the function is:
int rename(const char *oldname, const char *newname)
Zero is returned upon success, and other integers are returned upon failure.
The rename function is specified in the stdio.h library header file in C and the cstdio
header in C++. It is specified in ANSI C.
In POSIX, rename will fail (with EXDEV) if the old and new names are on different mounted file systems. On Linux, if a call to rename succeeds it is guaranteed to have been atomic from the point of view of the current host.