Gives a new name to an existing file.
#include <stdio.h> int rename (const char *old_file_spec, const char *new_file_spec);
If the new_file_spec does not contain a file extension, the file extension of old_file_spec is used. To rename a file to have no file extension, new_file_spec must contain a period (.) For example, the following renames SYS$DISK:[]FILE.DAT to SYS$DISK:[]FILE1.DAT:
rename("file.dat", "file1");
Whereas the following renames SYS$DISK:[]FILE.DAT to SYS$DISK:[]FILE1:
rename(file.dat", "file1.");
0 | Indicates success. |
nonzero value | Indicates failure. |