home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / SIDEUNIT.ZIP / TESTSIDE.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1989-07-19  |  1.6 KB  |  57 lines

  1. { This program demonstrates the use of the procedure Sideways and
  2.   the unit SideUnit.  The prompt to check the printer is just a
  3.   precaution because the program bombs if a printer is unavailable.
  4.   Katherine Degerberg
  5. }
  6.  
  7. Program TestSide;
  8. uses SideUnit,Crt;
  9.  
  10. var
  11.    Ch       : Char;     { Response Character }
  12.    FileName : String;   { Name of File to Printe }
  13.    IBM      : Boolean;  { Flag indicating type of printer }
  14.  
  15. begin
  16.  
  17.      { Get the printer type.  Only two main types are supported:
  18.        IBM and compatibles and Epson and compatibles. }
  19.  
  20.      Write('Do you have an IBM printer? [Y/n] : ');
  21.      ch := Readkey; if ch = #0 then ch := Readkey;
  22.      Writeln;
  23.  
  24.      if UpCase(ch) = 'N' then
  25.         IBM := False
  26.      else
  27.         IBM := True;
  28.  
  29.      { Get the name of the file to be printed }
  30.      FileName := '';
  31.      repeat
  32.         Writeln;
  33.         Write('Enter name of file to be printed sideways: ');
  34.         Readln(FileName); Writeln;
  35.         If Filename = '' then Writeln('Invalid File Name');
  36.      until FileName <> '';
  37.      Writeln;
  38.  
  39.      { Prompt to check the printer - just in case }
  40.      Writeln('Check Printer  --- Press Any Key to Continue');
  41.      ch := Readkey; if ch = #0 then ch := Readkey;
  42.      Writeln;
  43.      Writeln('Printing File....');
  44.      Writeln;
  45.  
  46.  
  47.      { Sideways will return false if it could not find the
  48.        file to print it, so check what Sideways returns and
  49.        print an appropriate message. }
  50.      if Sideways(FileName,IBM) then
  51.         Writeln('File Successfully Printed')
  52.      else
  53.         Writeln('File does not exist, try again');
  54.      Writeln;
  55.  
  56. end. { of program TestSide }
  57.