[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 9.11 Append

### Synopsis

    procedure Append (var F: any file; [FileName: String;]
                                        [BlockSize: Cardinal]);

### Description

``Append'` opens a file for writing. If the file does not exist, it is created. If it does exist, the file pointer is positioned after the last element.

Like ``Rewrite'`, ``Reset'` and ``Extend'` do, ``Append'` accepts an optional second and third parameter for the name of the file in the filesystem and, for untyped files, the block size of the file. (For details, see section 9.233 Rewrite.)

### Conforming to

``Append'`, including the ``BlockSize'` parameter, is a Borland Pascal extension. ISO-10206 Extended Pascal has section 9.81 Extend instead. The ``FileName'` parameter is a GNU extension.

### Example

    program AppendDemo;
    var
      Sample: Text;
    begin
      Assign (Sample, 'sample.txt');
      Rewrite (Sample);
      WriteLn (Sample, 'Hello, World!');  { `sample.txt' now has one line }
      Close (Sample);

      { ... }

      Append (Sample);
      WriteLn (Sample, 'Hello again!');   { `sample.txt' now has two lines }
      Close (Sample)
    end.

### See also

section 9.18 Assign, section 9.227 Reset, section 9.233 Rewrite, section 9.292 Update, section 9.81 Extend.

This document was generated by Frank Heckenbach on May, 10 2002 using texi2html