comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: How to redirect std.-output to a textfile?
Date: 1999/05/21
Date: 1999-05-21T00:00:00+00:00	[thread overview]
Message-ID: <#77oLY7o#GA.184@newstoo.hiwaay.net> (raw)
In-Reply-To: 3745564B.24A460B0@minet.uni-jena.de


Andreas Hoffmann <andreas3@minet.uni-jena.de> wrote in message
news:3745564B.24A460B0@minet.uni-jena.de...
>
> >    Ada.Text_IO.Set_Output (myfile);
>
> Tanks very much, it works fine!

This may be splitting semantic hairs, but Set_Output _does not_
redirect standard output -- it simply sets the _default_
output -- i.e., the file to which the is written the result of
file operations such as Put, Put_Line, New_Line, etc., in the
absence of the File parameter in the call.

Even though the _default output_ has been written to some
specific file, a statement such as
Put_Line (Standard_Output, Something) will still be written
to the _standard output_, even though the _default output_
has been set to some specific file.

Sometimes the answer is wrong because the question is not
correctly put .
Here are a few relevant lines from the RM, section A.10.3

procedure Set_Output(File : in File_Type);
procedure Set_Error (File : in File_Type);

6 Each operates on a file of mode Out_File or Append_File.
Set_Output sets the current default output file to File.
Set_Error sets the current default error file to File.
The exception Status_Error is propagated if the given file
is not open. The exception Mode_Error is propagated if the
mode of the given file is not Out_File or Append_File.

7 function Standard_Input return File_Type;
  function Standard_Input return File_Access;

8 Returns the standard input file (see A.10), or an access
value designating the standard input file, respectively.

9 function Standard_Output return File_Type;
  function Standard_Output return File_Access;

10 Returns the standard output file (see A.10) or an access
value designating the standard output file, respectively.

11 function Standard_Error return File_Type;
   function Standard_Error return File_Access;







      reply	other threads:[~1999-05-21  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-21  0:00 How to redirect std.-output to a textfile? Andreas Hoffmann
1999-05-21  0:00 ` David C. Hoos, Sr.
1999-05-21  0:00 ` Dale Stanbrough
1999-05-21  0:00   ` Andreas Hoffmann
1999-05-21  0:00     ` David C. Hoos, Sr. [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox