
------------------------------------------------------------------------------
6.2 Change the name of a file. <Main,Alarm,Comm>
------------------------------------------------------------------------------
[Name]
rename
[Syntax]
#include <stdio.h>
int rename( const char *oldname, const char *newname ) ;
[Arguments]
oldname Pointer to the old name.
newname Pointer to the new name.
[Return]
Returns zero if file name has been successfully changed. If not,
returns -1 and sets an one of following values in the global variable
"errno".
Symbol Meaning
---------------+-----------------------------------------------------
EACCES A file or directory whose name is "newname" already
exists, "path" is invalid, or a different path is
specified in "newname" for a directory.
ENOENT Specified file or path does not exist.
EXDEV Attempted moving a file to the another device.
[Description]
Changes a file name or directory name specified by "oldname" to a
new name specified by "newname". The old name must be a path name
of a file or a directory which already exists. The new name must not
be a path name of a file or a directory which already exists. A file
can be moved from some directory to another one by specifying a
different path name in "oldname" from "newname". But it is impossible
to move a file from some device to the another device. For directory,
only renaming is available, moving is not available.
(Note) The library of the current version can not move any file. rename()
function calling to move a file makes an error. (errno=EACCES)