Utility Library Chapter 8
LabWindows/CVI Standard Libraries 8-60 © National Instruments Corporation
RenameFile
int result = RenameFile (char existingFileName[], char newFileName[]);
Purpose
Renames an existing file.
Parameters
Input existingFileName string Existing file name.
newFileName string New file name.
Return Value
result integer Result of rename operation.
Return Codes
0 Success.
-1 File not found or directory in path not found.
-3 General I/O error occurred.
-4 Insufficient memory to complete operation.
-5 Invalid path (for either of the file names).
-6 Access denied.
-7 Specified existing path is a directory, not a file.
-8 Disk is full.
-9 New file already exists.
Parameter Discussion
existingFileName and newFileName may contain DOS wildcard characters ‘?’ and ‘*’. If
existingFileName has wildcards, all matching files are renamed. If newFileName has
wildcards, it will be matched to existingFileName.
existingFileName may be the empty string (""), in which case the file found by the most recent
call to GetFirstFile or GetNextFile is renamed.
Under Microsoft Windows, if the arguments to RenameFile specify files on different disk
drives, RenameFile copies the source to the target and then deletes the source file.