|
renamefunction
<cstdio>
int rename ( const char * oldname, const char * newname ); Rename file Changes the name of the file or directory specified by oldname to newname.If oldname and newname specify different paths and this is supported by the system, the file is moved to the new location. This is an operation performed directly on a file; No streams are involved in the operation. Parameters
Return valueIf the file is successfully renamed, a zero value is returned.On failure, a nonzero value is returned and the errno variable is set to the corresponding error code. Error codes are numerical values representing the type of failure occurred. A string interpreting this value can be printed to the standard error stream by a call to perror. Example
If the file oldname.txt could be succesfully renamed to newname.txt the following message would be written to stdout: File successfully renamed Otherwise, a message similar to this will be written to stderr: Error renaming file: Permission denied See also
|