Name

Output Variable

Syntax

var Output: TextFile;

Description

The Output variable is a text file that Delphi automatically opens for writing, but only in console applications. The output file is usually the console, but the user can redirect output from the command shell.

Output is an ordinary TextFile, and you can close it or open a different file. Opening a file without a name is the same as opening the console file. For example, Delphi always performs the following when a console application starts running:

AssignFile(Output, '');
Rewrite(Output);

Calling Write and WriteLn without a file reference as the first argument is the same as calling Write and WriteLn using Output as the first argument.

See Also

AssignFile Procedure, Input Variable, TextFile Type, Write Procedure, WriteLn Procedure

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.