comp.lang.ada
 help / color / mirror / Atom feed
* how to designate standard input from another file
@ 2000-06-05  0:00 Terry Westley
  2000-06-05  0:00 ` Jean-Pierre Rosen
  0 siblings, 1 reply; 3+ messages in thread
From: Terry Westley @ 2000-06-05  0:00 UTC (permalink / 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.
-------------------------------------------------------







^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-06-05  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox