next up previous contents index
Next: Arctan Up: Functions and Procedures Previous: Addr

Append

   

Declaration:

Procedure Append (Var F : Text) ;

Description:

Append opens an existing file in append mode. Any data written to F will be appended to the file. If the file didn't exist, it will be created, contrary to the Turbo Pascal implementation of Append, where a file needed to exist in order to be opened by append.

Only text files can be opened in append mode.

Errors:

If the file can't be created, a run-time error will be generated.

See also:

Rewrite,Append, Reset

Example
Program Example3;

{ Program to demonstrate the Append function. }

Var f : text;

begin
  Assign (f,'test.txt');
  Rewrite (f);            { file is opened for write, and emptied }
  Writeln (F,'This is the first line of text.txt');
  close (f);
  Append(f);              { file is opened for write, but NOT emptied. 
                            any text written to it is appended.}
  Writeln (f,'This is the second line of text.txt');
  close (f);
end.



Michael Van Canneyt
Thu Sep 10 14:02:43 CEST 1998