CT_FILEAPPEND

 FILEAPPEND()
 Appends data to a file

 Syntax

     FILEAPPEND(<cSourceFile>, <cTargetFile>)
        --> nAttachedByte

 Arguments

     <cSourceFile>  Designates the file that is appended to
     <cTargetFile>.

     <cTargetFile>  Designates the file to which <cSource> is appended.
     Drive and path designation are permitted for both files, wildcards are
     not.

 Returns

     FILEAPPEND() returns the number of characters appended on to
     <cTargetFile>.

 Description

     FILEAPPEND() takes fragmented files, split them up on different floppies
     and reassemble them.  This sort of fragmented file could be created with
     the FILECOPY() system described in this chapter.  You only need explicit
     information, such as VOLUME labels, to recognize the different disks.
     If the target file does not exist, it is created with FILEAPPEND().  If
     an error occurs while appending to the target file, the file deletes
     completely to avoid accidental and incorrect results.

     Never append data to file if there is no backup copy.

 Notes

     .  Use SETFCREATE(), if FILEAPPEND() creates a new file and an
        alternative attribute needs to be specified.

     .  Use SETSHARE() to protect a target file from access, if it is
        on a network drive.

 Examples

     Shown below is a simplified program to reassemble a file that is divided
     among several disks by a FILECOPY() backup.

     A catalog contains a list of the disks used during backup in the form of
     volume labels and backup file names.

     Structure of the DISKLIST catalog:

     Table 7-10: DISKLIST File Structure
     ------------------------------------------------------------------------
     Field Name     Field Content
     ------------------------------------------------------------------------
     VolLabel       Back up disk drive and volume label
     BackupName     Back up file name, incl. drive and path
     ------------------------------------------------------------------------

     The data in DISKLIST is created by a FILECOPY() backup:

     USE DISKLIST                                 // Saved volume labels
     cTargetFile  :=  "C:\TARGET.TXT"
     DO WHILE .NOT. EOF()
        IF .NOT. EMPTY(FILESEEK(cVolLabel, 8)     // Correct disk ?
           FILEAPPEND(cBackupName, cTargetFile)   // Yes, append data
           SKIP
        ELSE
           ? "Please insert the correct disk  !"
        ENDIF
     ENDDO

See Also: FILECOPY() FILESEEK() SETSHARE() SETFCREATE() CSETSAFETY()

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.