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

<nAttachedByte> : 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(). Only need is 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.

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:

      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

Seealso

FileCopy(), FileSeek()

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s