DelphiBasics
Input
Variable
Defines the standard input text file System unit
  var Input : TextFile;
Description
The Input variable is predefined by Delphi to refer to the standard text input file.
 
This is normally the console, but may be overriden to any file using the AssignFile statement.
 
Input is used in the text file Read, ReadLn 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
Output Defines the standard output text file
Read Read data from a binary or text file
ReadLn Read a complete line of data from a text file
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.


 
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
 
Delphi Programming Neil Moffatt 2002 - 2016. All rights reserved.  |  Home Page