home *** CD-ROM | disk | FTP | other *** search
- -- Chapter 14 - Program 2
- with Text_IO;
- use Text_IO;
-
- procedure EasyOut is
-
- package Int_IO is new Text_IO.Integer_IO(INTEGER);
- use Int_IO;
-
- Turkey : FILE_TYPE;
-
- begin
- -- First we create the file
- Create(Turkey,Out_File,"TEST.TXT");
- -- Then we write to it
- Put_Line(Turkey,"This is a test of turkey");
- Put(Turkey,"and it should work well.");
- New_Line(Turkey,2);
- Put_Line("Half of the turkey test");
-
- Set_Output(Turkey); -- Make Turkey the default output
- Put_Line("This is another test of turkey");
- Put("and it should work well.");
- New_Line(2);
- Put_Line(Standard_Output,"Half of the turkey test");
- Set_Output(Standard_Output); -- Return to the Standard default
-
- Put_Line("Back to the standard default output.");
- Close(Turkey);
-
- end EasyOut;
-
-
-
-
- -- Result of execution
-
- -- (Output to the monitor follows)
- --
- -- Half of the turkey test
- -- Half of the turkey test
- -- Back to the standard default output
-
- -- (Output to the file TEST.TXT)
- --
- -- This is a test of turkey
- -- and it should work well.
- --
- -- This is another test of turkey
- -- and it should work well.
-
-