Procedure Append (Var F : Text) ;
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.
If the file can't be created, a run-time error will be generated.
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.