int rename(const char *oldpath, const char *newpath);
- Return value:
- On success, zero is returned. On error, -1 is returned.
- newpath is an existing directory, but oldpath is not a
- newpath is a non-empty directory.
- oldpath or newpath is a directory that is in use by some
- An attempt was made to make a directory a subdirectory
- A component used as a directory in oldpath or new
path is not a directory. Or oldpath is a directory
and newpath exists but is not a directory.
- oldpathptr or newpathptr are invalid pointer values.
- No access to the file or the path of the file.
oldpath or newpath was too long.
- A directory component in oldpath or newpath does not exist.
- The file is on a read-only filesystem.
- The device containing the file has no room for the new
- The call was interrupted by the user.