comp.lang.ada
 help / color / mirror / Atom feed
From: "Terry Westley" <twestley@buffalo.veridian.com>
Subject: how to designate standard input from another file
Date: 2000/06/05
Date: 2000-06-05T00:00:00+00:00	[thread overview]
Message-ID: <amQ_4.2$m22.237@wdc-read-01.qwest.net> (raw)

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







             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 Terry Westley [this message]
2000-06-05  0:00 ` how to designate standard input from another file Jean-Pierre Rosen
2000-06-05  0:00   ` Terry Westley
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox