C5_FRENAME

 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

 

One response to “C5_FRENAME

  1. Pingback: C5_RENAME | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.