rename
- Updated2023-02-21
- 2 minute(s) read
rename
int rename (const char oldFileName[], const char newFileName[]);
Purpose
Causes the file or directory specified by oldFileName to be known by the name given in newFileName. The file named oldFileName is no longer accessible by that name. Fails if a file already exists with the name given in newFileName. This function fails if the oldFileName and newFileName do not refer to the same disk drives.
![]() |
Note If the function fails, the file will still be known by the original name specified in oldFileName. |
![]() |
Note If you want to rename files across drives or file systems, you can use RenameFile in the Utility Library. |
Parameters
Input | ||
Name | Type | Description |
oldFileName | const char [] | Contains the name of the file that is renamed to newFileName. The file specifed in this parameter is no longer accessible by this name. |
newFileName | const char [] | Contains the name that the file specified in oldFileName is renamed to. If successful, the file is accessible by this name. |
Return Value
Name | Type | Description | ||
status | int |
Contains the resulting status of the function. If successful, rename returns 0. If
an error occurs, rename returns a nonzero value and sets errno to a nonzero value.
|
Additional Information
Library: ANSI C Library
Include file: ansi_c.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later