PROGRAM PRINTFILE(INPUT,OUTPUT);

LABEL 1;

var
 f :text;
 s :array[0..80] of char;
 PRINTER :INTEGER;
 ANS :INTEGER;

procedure TOSCREEN;

BEGIN
  Reset(f,s);
  while not eof(f) do begin
    if eoln(f) then writeln
    else write(f^);
    get(f);
  end;
END;

procedure toprinter;

BEGIN  
   reset(f,s);
#i D:PR.ON
   while not eof(f) do begin
     if eoln(f) then writeln
     else write(f^);
     get(f);
   end;
#i D:PR.OFF
END;


  begin

1: Printer := 0;
  write(CHR(125));
  writeln('This program will allow you to look');
  Writeln('at any disk file. It is designed');
  Writeln('as a demo for KYAN pascal');
  Writeln;
  Writeln('press <RETURN> to continue');
  readln(s);
  WRITELN('1) PRINTER');
  WRITELN('2) SCREEN ');
  Readln(ANS);
  printer := ans;
  if printer = 0 Then goto 1;
  write('FILENAME? ');readln(s);
  if printer = 1 Then toprinter;
  if printer = 2 then toscreen;
  Writeln;
  Writeln('press <RETURN> to continue');
  readln(s);
  GOTO 1;
end.
