Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Append Procedure
◄Summary► ◄Details► ◄Example► ◄Back►
Argument
file_variable Text file; must be previously assigned
Description
The Append procedure opens an existing text file and prepares it
for the appending of new text. The new text is added to the
existing contents of the file. The opened file is the disk file or
device that has the file name previously associated with
file_variable. Use the Assign procedure to associate a file name
with file_variable.
Append moves the current file position to the end of the file. The
Eof function always returns True for the file.
A file opened with Append is write-only. Write and Writeln are the
only legal I/O operations to a write-only file.
Append applies only to text files. To append to a typed or untyped
file, Reset the file. Then move the current position to the end of
the file by calling the Seek procedure or making repeated calls to
the Read or BlockRead procedures.
To refer to the standard file Output (file handle 1), call Assign
with a null string argument and then Append the file.
If the file ends with CTRL+Z (ASCII 26) or if CTRL+Z appears in the
last 128-byte block of the file, Append sets the current file
position so that output begins at the first CTRL+Z in that block.
Subsequent output to the file overwrites the CTRL+Z.
If the external file is already open, Append closes and then
reopens the file.
If no external file with the assigned name exists, an I/O error
occurs.
To prevent a program from halting with a run-time error when an I/O
error occurs, turn off I/O checking with {$I-} and check the
return value of the IOResult function.