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.
PRINTFL.PAS
◄Example► ◄Contents► ◄Index► ◄Back►
PROGRAM printfl;
{ PRINTFL.PAS demonstrates the following procedures:
Assign AssignCrt
It also uses these standard routines:
Close ParamStr Reset Write
ParamCount Readln Rewrite Writeln
}
USES
Crt;
CONST
program_name = 'PRINTFL ';
program_desc = 'prints a file on the display or the printer.';
VAR
filename : STRING;
output_to : Char;
infile : Text;
outfile : Text;
one_line : STRING;
BEGIN
Writeln( program_name, program_desc );
Writeln;
IF (ParamCount > 1) THEN
BEGIN
Writeln( 'SYNTAX: printfl <filename>' );
Exit;
END
ELSE IF (ParamCount = 1) THEN
filename := ParamStr( 1 )
ELSE
BEGIN
Write( 'File to print or display: ');
Readln( filename );
END;
REPEAT
Write( 'Output to Printer (''P'') or Display (''D'')' );
Readln( output_to );
output_to := UpCase( output_to );
UNTIL (output_to = 'P') OR (output_to = 'D');
IF (output_to = 'P') THEN
Assign( outfile, 'PRN' )
ELSE
AssignCrt( outfile );
Assign( infile, filename );
Reset( infile );
Rewrite( outfile );
WHILE NOT Eof( infile ) DO
BEGIN
Readln( infile, one_line );
Writeln( outfile, one_line );
END;
Close( infile );
Close( outfile );
END.