Mega Code Archive

 
Categories / Delphi / Variables
 

Output - defines the standard output text file

var Output : TextFile; Description The Output variable is predefined by Delphi to refer to the standard text output file. This is normally the console, but may be overriden to any file using the Assign statement. Output is used in the text file Write, WriteLn and Seek routines. It may be omitted in these commands however, since it is the default file. Related commands $AppType Determines the application type : GUI or Console Input Defines the standard input text file Write Write data to a binary or text file WriteLn Write a complete line of data to a text file Example code : Read and write to the console program Project1; {$AppType CONSOLE} uses SysUtils; var name : string; begin // A console application has the console Input and Output // assigned and opened on our behalf. WriteLn(Output, 'Please enter your name'); ReadLn(Input, name); // And we do not even have to refer to these file names WriteLn('Your name is '+name); WriteLn(''); WriteLn('Press enter to exit'); ReadLn(name); end. Example console output : Please enter your name Joe Bloggs Your name is Joe Bloggs Press enter to exit