7.19.4.2 The rename function

Synopsis

1

#include <stdio.h>
int rename(const char *old, const char *new);

Description

2

The rename function causes the file whose name is the string pointed to by old to be henceforth known by the name given by the string pointed to by new. The file named old is no longer accessible by that name. If a file named by the string pointed to by new exists prior to the call to the rename function, the behavior is implementation-defined.

Returns

3

The rename function returns zero if the operation succeeds, nonzero if it fails,[1] in which case if the file existed previously it is still known by its original name.

Footnotes