Next: , Previous: exports, Up: Reference


(Under construction.)


     procedure Extend (var F: any_file; [FileName: String;]
                                         [BlockSize: Cardinal]);


Extend 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 Append do, Reset accepts an optional second parameter for the name of the file in the filesystem and a third parameter for the block size of the file. The third parameter is allowed only (and by default also required) for untyped files. For details, see Rewrite.

Conforming to

Extend is an ISO 10206 Extended extension. Borland Pascal has Append instead. The BlockSize parameter is a Borland Pascal extension. The FileName parameter is a GNU Pascal extension.


     program ExtendDemo;
       Sample: Text;
       Assign (Sample, 'sample.txt');
       Rewrite (Sample);
       WriteLn (Sample, 'Hello, World!');  { `sample.txt' now has one line }
       Close (Sample);
       { ... }
       Extend (Sample);
       WriteLn (Sample, 'Hello again!');  { `sample.txt' now has two lines }
       Close (Sample)

See also

Assign, Reset, Rewrite, Update, Append.