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

  1.                                        -- Chapter 14 - Program 2
  2. with Text_IO;
  3. use Text_IO;
  4.  
  5. procedure EasyOut 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,"TEST.TXT");
  15.                              -- Then we write to it
  16.    Put_Line(Turkey,"This is a test of turkey");
  17.    Put(Turkey,"and it should work well.");
  18.    New_Line(Turkey,2);
  19.    Put_Line("Half of the turkey test");
  20.  
  21.    Set_Output(Turkey);       -- Make Turkey the default output
  22.       Put_Line("This is another test of turkey");
  23.       Put("and it should work well.");
  24.       New_Line(2);
  25.       Put_Line(Standard_Output,"Half of the turkey test");
  26.    Set_Output(Standard_Output); -- Return to the Standard default
  27.  
  28.    Put_Line("Back to the standard default output.");
  29.    Close(Turkey);
  30.  
  31. end EasyOut;
  32.  
  33.  
  34.  
  35.  
  36. -- Result of execution
  37.  
  38. -- (Output to the monitor follows)
  39. --
  40. -- Half of the turkey test
  41. -- Half of the turkey test
  42. -- Back to the standard default output
  43.  
  44. -- (Output to the file TEST.TXT)
  45. --
  46. -- This is a test of turkey
  47. -- and it should work well.
  48. --
  49. -- This is another test of turkey
  50. -- and it should work well.
  51.  
  52.