Name

Append Procedure

Syntax

procedure Append(var F: TextFile);

Description

The Append procedure opens an existing text file for writing. The initial file position is the end of the file, so future writes append to the end of the file.

The Append procedure is built into the compiler. For an example, see the AssignFile Procedure.

Errors

  • If you have not called AssignFile before Append, Delphi reports I/O error 102.

  • If the file cannot be opened for any reason, Append reports the Windows error code as an I/O error.

Tips and Tricks

Note that you cannot open a typed or untyped binary file for appending—only text files. To append to a binary file, call Reset and seek to the end of the file.

See Also

AssignFile Procedure, CloseFile Procedure, Eof Function, IOResult Function, Reset Procedure, Rewrite Procedure, TextFile Type, $I Compiler Directive, $IOChecks Compiler Directive

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.