comp.lang.ada
 help / color / mirror / Atom feed
From: "Terry Westley" <twestley@buffalo.veridian.com>
Subject: Re: how to designate standard input from another file
Date: 2000/06/05
Date: 2000-06-05T00:00:00+00:00	[thread overview]
Message-ID: <vwU_4.13$m22.2659@wdc-read-01.qwest.net> (raw)
In-Reply-To: 8hgnp5$r7k$1@wanadoo.fr

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.
-------------------------------------------------------







      reply	other threads:[~2000-06-05  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-06-05  0:00 how to designate standard input from another file Terry Westley
2000-06-05  0:00 ` Jean-Pierre Rosen
2000-06-05  0:00   ` Terry Westley [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