int rename(const char *old, const char *new);
This system call implements the POSIX rename function, which changes the name of an existing file.Since this function is based on the rather limited DOS rename operation, it can't be used to rename a directory, or to move a file from one directory to another. Furthermore, if the file named by new already exists, MOSS will emulate proper POSIX behavior by removing the existing file and replacing it with old; however, this operation will not be atomic as it should be under POSIX.
- old
- The pathname of the file to rename.
- new
- The new name for the file.
Returns 0 if successful, or -1 on error, in which case errno indicates the error.