Home  |  Delphi .net Home  |  System.Console  |  ReadLine Method
ReadLine  
Method  
Reads a line of characters from the Standard Input Stream
Console Class
System NameSpace
CF1.  Function ReadLine ( ) : String; Static;
CF : Methods with this mark are Compact Framework Compatible
Description
Attempts to read a line of characters from the standard input stream.
 
This may incur an exception, so for precise control it is better to use the Read method.
 
The line of text is deemed complete when the user has pressed enter, or the current sequence of characters has been terminated by line feed/throw characters if reading from a file. Only the characters (if any) before the carriage return (13) or line feed (10) characters are returned.
Notes
Static methods are not methods of an object - they are simply class functions or procedures available at any time.
Microsoft MSDN Links
System
System.Console
 
 
A simple example
program Project1;
{$APPTYPE CONSOLE}

var
  name : String;

begin
  Console.WriteLine('Please enter your name : ');

  name := Console.ReadLine;

  Console.WriteLine('Thanks ' + name);

  Console.ReadLine;
end.
Show full unit code
  Please enter your name :
  Neil
  Thanks Neil
 
 
Delphi Programming © Neil Moffatt All rights reserved.  |  Contact the author