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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!bu.edu!inmet!stt From: stt@inmet.inmet.com Newsgroups: comp.lang.ada Subject: Re: Text_Io Questions Message-ID: <20600077@inmet> Date: 29 Jan 91 17:58:00 GMT References: <185319@<1991Jan26> Nf-ID: #R:<1991Jan26:185319:inmet:20600077:000:1466 Nf-From: inmet.inmet.com!stt Jan 29 12:58:00 1991 List-Id: Re: Text-IO questions. 1) Open with append There is a semi-standard Form string of "APPEND=>YES" which several compilers recognize to get open with append. I think is what the Posix/Ada binding proposed. To be completely portable, you generally have to create a temp file, copy the contents of the old file into the new file, and then write your new data onto the end of the temp file. When all done you copy the temp file back on top of the old file. One final mechanism is to write just your new data to a temp file, and then call a Unix.System("cat temp_file >> old_file") subprogram that some vendors provide. 2) Standard Output or other file As far as having a file which is either Standard_Output or some other file, you can use the function Current_Output instead, which is initially Standard_Output, but may be changed by a Set_Output call. If this is not flexible enough, you can write your own function Switchable_Output, which takes a File_Type and returns it if Is_Open returns True, and returns Standard_Output otherwise. For example: function Switchable_Output(File : File_Type) return File_Type is begin if Is_Open(File) then return File; else return Standard_Output; end if; end Switchable_Output; S. Tucker Taft Intermetrics, Inc. Cambridge, MA 02138 P.S. Text-IO has been identified in the Ada 9X requirements document as requiring additional functionality, in particular the open-with-append capability.