[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FRENAME()
 Change the name of a file
------------------------------------------------------------------------------
 Syntax

     FRENAME(<cOldFile>, <cNewFile>) --> nSuccess

 Arguments

     <cOldFile> is the name of the file to be renamed, including the file
     extension.  A drive letter and/or path name may also be included as part
     of the file name.

     <cNewFile> is the new name of the file, including the file
     extension.  A drive letter and/or path name may also be included as part
     of the name.

 Returns

     FRENAME() returns -1 if the operation fails and zero if it succeeds.  In
     the case of a failure, FERROR() can be used to determine the nature of
     the error.

 Description

     FRENAME() is a file function that changes the name of a specified file
     to a new name and is identical to the RENAME command.

     When FRENAME() is called, <cOldFile> is renamed only if it is located in
     the current DOS directory or in the specified path.  FRENAME() does not
     use SET DEFAULT or SET PATH to locate <cOldFile>.

     If the source directory is different from the target directory, the file
     moves to the target directory.  In the instance that either <cNewFile>
     exists or is currently open, FRENAME() fails and returns -1, indicating
     that it did not perform its designated action.  The nature of the error
     can be determined with FERROR().

     Warning!  Files must be CLOSEd before renaming.  Attempting to
     rename an open file will produce unpredictable results.  When a database
     file is renamed, the associated memo (.dbt) file must also be renamed.
     Failure to do so may compromise the integrity of your databases.

 Examples

     .  This example demonstrates a file rename:

        IF FRENAME("OldFile.txt", "NewFile.txt") == -1
           ? "File error:", FERROR()
        ENDIF

 Files   Library is CLIPPER.LIB.


See Also: CLOSE ERASE FERASE() FERROR() FILE() RENAME
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson