Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
SHOW.PAS
◄Example► ◄Contents► ◄Index► ◄Back►
PROGRAM show;
{ SHOW.PAS displays a file, a screen at a time, using direct I/O as
defined in the Crt unit. It demonstrates the routines:
ClrScr Eof LastMode ReadKey UpCase Write Writeln
In addition, it uses the following routines for normal text file
operations:
Assign Close Readln Reset
}
USES
Crt; { by default, I/O to screen will bypass DOS }
CONST
program_name = 'SHOW ';
program_desc = ' displays the file named on the command line.';
VAR
show_file : Text;
a_line : STRING;
i : Integer;
n_lines : Integer;
answer : Char;
BEGIN
Writeln( program_name, program_desc );
Writeln;
IF ParamCount <> 1 THEN
BEGIN
Writeln( 'SYNTAX: show <filename>' );
Exit;
END;
Assign( show_file, ParamStr( 1 ) );
Reset( show_file );
{ Test video mode and use maximum lines for this mode. }
IF ((LastMode AND Font8x8) > 0) THEN
n_lines := 42
ELSE
n_lines := 24;
REPEAT
ClrScr;
FOR i := 1 TO n_lines DO
BEGIN
Readln( show_file, a_line );
Writeln( a_line );
END;
Write( 'Press ENTER for more or ''q'' to quit>' );
answer := ReadKey;
Writeln( answer );
UNTIL (Eof( show_file ) OR (UpCase( answer ) = 'Q'));
Writeln;
Close( show_file );
END.