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,e771677aa5f6a605 X-Google-Attributes: gid103376,public From: "Terry Westley" Subject: Re: how to designate standard input from another file Date: 2000/06/05 Message-ID: #1/1 X-Deja-AN: 631448706 References: <8hgnp5$r7k$1@wanadoo.fr> 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 960238747 137.100.53.39 (Mon, 05 Jun 2000 14:59:07 MDT) X-MSMail-Priority: Normal NNTP-Posting-Date: Mon, 05 Jun 2000 14:59:07 MDT Newsgroups: comp.lang.ada Date: 2000-06-05T00:00:00+00:00 List-Id: Jean-Pierre Rosen writes: > Do it the other way round, i.e. read from Standard_Input, and redirect it if necessary: > declare > File : Ada.Text_IO.File_Type; > begin > if File_Name /= "-" then > Ada.Text_IO.Open (File, In_File, File_Name); > Ada.Text_IO.Set_Input (File); > end if; > end; Yes, I know this will work; I've done it. But, what if there are two files for which you want to allow the user to specify standard input for either file? The code above won't work unless you require that only one file be standard input. And, if the files have some sort of precedence (as in diff, compare, or merge), you've lost that unless you keep flags indicating which one is default input and which is an opened file. -- 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. -------------------------------------------------------