Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper Tools . Books 1-3 - <b>filecopy()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 FILECOPY()
 Copies files normally or in backup mode
------------------------------------------------------------------------------
 Syntax

     FILECOPY(<cSourceFile>, <cTargetFile>, [<lMode>])
        --> nCopyByte

 Arguments

     <cSourceFile>  Designates the source file.  Drive and path
     designations are permitted, but not wildcards.

     <cTargetFile>  Designates the target file.  Drive and path
     designations are permitted, but not wildcards.

     <lMode>  Designates the backup mode on when designated as .T.  The
     default is no backup mode (.F.).

 Returns

     FILECOPY() returns the number of bytes copied.

 Description

     This function has additional uses besides allowing you to quickly copy
     files.  When you use the optional <lMode> parameter, a unique backup
     mode is switched on.  This allows files that are larger than the target
     disks to be copied.  This function writes the maximum possible number of
     bytes to a disk.  FILECOPEN() allows you to determine whether all data
     from the source file has been copied.  It then continues with the next
     disk.  The target disks should contain unique labels and be saved to a
     catalog.

 Notes

     .  The attribute to be used when newly creating a file can be
        specified with SETCREATE().

     .  As a minimum, the share mode recommends that you do not write
        other program source and target files.

     .  This function acknowledges the CSETSAFETY() setting, and as a
        result, cannot overwrite a target file.

 Examples

     .  Show a simple copy:

        ? FILECOPY("A:\TEXT.TXT", "C:\TEST.TXT")      // Bytes copied

     .  A back up using FILECOPY():

        nCounter  :=  1                               // "BIG.001" etc.
        cTargetFile  := "BIG" + NTOC(nCounter, 10, 3, "0")
        FILECOPY("BIG.DBF", "A:\" + cTargetFile, .T.)
                                                      // Back up mode
        DO WHILE FILECOPEN()
           DO NEXTDISK                                // Request disk change
           nCounter     := nCounter + 1
           cTargetFile  := "BIG" + NTOC(nCounter, 10, 3, "0")
           FILECCONT(cTargetFile)                     // Next disk - new name
        ENDDO
        RETURN

        PROCEDURE NEXTDISK
           ? "Please insert new diskette in Drive A:!"
           WAIT
           RETURN


See Also: FILECCONT() FILECOPEN() FILECCLOSE() FILEAPPEND()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson