- 4.67.2.68. -
Table of Contents
4. Standard Units
4.67. System - Built-in routines
4.67.2. System Unit Procedures and Functions
4.67.2.68. ReadLn procedure
4.67.2.68. ReadLn procedure
Targets: MS-DOS, OS/2, Win32
System Unit
Executes the Read procedure then skips to the next line
of the file.
Declaration:
procedure ReadLn([ var F: Text;] V1 [, V2, ...,Vn ]);
Remarks:
Depending on the type of the variable or variables passed,
ReadLn copies the contents of the file,
from the current file pointer, into the variable and advances the pointer.
If ReadLn cannot match the type of the variable
with the contents of the file, an I/O error occurs.
End of line (#13) as well as end of file (#26) cause ReadLn
to terminate.
The file must be a text file or standard input. ReadLn
is identical to Read except that it
advances passed the end of line marker.
With {$I-}, IOResult returns an error
code if the operation was not successful. If no error was encountered,
IOResult is set to zero.
Example:
{$ifndef __CON__}
This program must be compiled as console application only
{$endif}
var
Name: String;
Age: DWORD;
begin
Write('Enter your name: ');
ReadLn(Name);
Write('Enter your age : ');
ReadLn(Age);
if Age < 21 then
WriteLn('You'’re so young, ', Name, '!')
else if Age < 40 then
WriteLn(Name, ', you''re still in your prime!')
else if Age < 60 then
WriteLn('You''re over the hill, ', Name, '!')
else if Age < 80 then
WriteLn('I bow to your wisdom, ', Name, '!')
else
Writeln('Are you really ', Age, ', ', Name, '?');
end.
See also:
User Defined Reader Procedure
- 4.67.2.68. -