From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,32141a0adc9d34f9 X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: How to redirect std.-output to a textfile? Date: 1999/05/21 Message-ID: <#77oLY7o#GA.184@newstoo.hiwaay.net>#1/1 X-Deja-AN: 480618086 Content-Transfer-Encoding: 7bit References: <37453F4F.53BA2EC8@minet.uni-jena.de> <3745564B.24A460B0@minet.uni-jena.de> Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 Newsgroups: comp.lang.ada X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Date: 1999-05-21T00:00:00+00:00 List-Id: Andreas Hoffmann 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;