Renames a file by low-level access
FRENAME( <cOldFile>, <cNewFile> ) --> nSuccess
<cOldFile> Old filename to be changed
<cNewFile> New filename
<nSuccess> If successful, a 0 will be returned otherwise, a -1 will be returned.
This function renames the specified file <cOldFile> to <cNewFile>. A filename and/or directory name may be specified for either parameter. However, if a path is supplied as part of <cNewFile> and this path is different from either the path specified in <cOldFile> or (if none is used) the current drive and directory, the function will not execute successfully.
Neither parameter is subject to the control of the SET PATH TO or SET DEFAULT TO commands. In attempting to locate the file to be renamed, this function will search the default drive and directory or the drive and path specified in <cOldFile>. It will not search directories named by the SET PATH TO and SET DEFAULT TO commands or by the DOS PATH statement.
If the file specified in <cNewFile> exists or the file is open, the function will be unable to rename the file. If the function is unable to complete its operation, it will return a value of -1. If it is able to rename the file, the return value for the function will be 0. A call to FERROR() function will give additional infor- mation about any error found.
#include "fileio.ch" nResult := FRename( "x.txt", "x1.txt" ) IF nResult == F_ERROR ? "File could not be renamed." ENDIF
Library is rtl