home *** CD-ROM | disk | FTP | other *** search
/ Chip 1995 March / CHIP3.mdf / programm / prog2 / printout.ada < prev    next >
Encoding:
Text File  |  1991-07-01  |  1.3 KB  |  58 lines

  1.                                        -- Chapter 14 - Program 7
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure PrintOut is
  6.  
  7.    package Int_IO is new Text_IO.Integer_IO(INTEGER);
  8.    use Int_IO;
  9.  
  10.    Turkey : FILE_TYPE;
  11.  
  12. begin
  13.                              -- First we create the file
  14.    Create(Turkey,Out_File,"LPT1");
  15.                              -- Then we write to it
  16.    Put(Turkey,"This is a test of turkey");
  17.    New_Line(Turkey);
  18.    Put(Turkey,"and it should work well.");
  19.    New_Line(Turkey,2);
  20.    Put("Half of the turkey test.");
  21.    New_Line;
  22.  
  23.    Set_Output(Turkey);       -- Make Turkey the default output
  24.       Put("This is another test of turkey");
  25.       New_Line;
  26.       Put("and it should work well.");
  27.       New_Line(2);
  28.       Put(Standard_Output,"Half of the turkey test.");
  29.       New_Line(Standard_Output);
  30.    Set_Output(Standard_Output); -- Return to the Standard default
  31.  
  32.    Put("Back to the standard default output.");
  33.  
  34.    Close(Turkey);
  35.  
  36. end PrintOut;
  37.  
  38.  
  39.  
  40.  
  41. -- Results of execution
  42.  
  43. -- (Output to the monitor)
  44. --
  45. -- Half of the turkey test.
  46. -- Half of the turkey test.
  47. -- Back to the standard default output.
  48.  
  49. -- (Output to the printer)
  50. --
  51. -- This is a test of turkey
  52. -- and it should work well.
  53. --
  54. -- This is another test of turkey
  55. -- and it should work well.
  56. --
  57.  
  58.