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,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e771677aa5f6a605,start X-Google-Attributes: gid103376,public From: "Terry Westley" Subject: how to designate standard input from another file Date: 2000/06/05 Message-ID: #1/1 X-Deja-AN: 631330626 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Complaints-To: news-admin@qwestip.net X-Trace: wdc-read-01.qwest.net 960221702 137.100.53.39 (Mon, 05 Jun 2000 10:15:02 MDT) X-MSMail-Priority: Normal NNTP-Posting-Date: Mon, 05 Jun 2000 10:15:02 MDT Newsgroups: comp.lang.ada Date: 2000-06-05T00:00:00+00:00 List-Id: A certain program reads two files designated by their names on the command line. I would like to be able to use the string "-" to designate standard input in place of a either file name, as is often done in Unix utilities. Its pretty obvious how to open a file and designate it as the default input (Ada.Text_IO.Set_Input), but I don't know how to read standard input designated by a Text_IO File_Type. Something like this would be nice except that File_Type is limited private: declare File : Ada.Text_IO.File_Type; begin if File_Name = "-" then File := Ada.Text_IO.Standard_Input; else Ada.Text_IO.Open (File, In_File, File_Name); end if; end; Then, I can just read from File rather than testing on every read whether I'm reading from File or Standard_Input. This has got to be easy; what am I missing? -- Terry J. Westley, Software Systems Engineering Supervisor Veridian Engineering, Calspan Operations twestley@buffalo.veridian.com http://www.veridian.com/ ------------------------------------------------------- Author of TASH, an Ada binding to Tcl/Tk. Visit the TASH web site at http://www.adatcl.com. -------------------------------------------------------