comp.lang.ada
 help / color / mirror / Atom feed
* Reading sequential data from Ada.Text_Io.Standard_Input?
@ 1996-07-09  0:00 David J. Fiander
  1996-07-09  0:00 ` Michael Paus
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: David J. Fiander @ 1996-07-09  0:00 UTC (permalink / raw)



So, I want to read from standard input, using Ada.Sequential_Io.
I've got

	declare
	    type Byte is mod 256; for Byte'Size use 8;
	    package Byte_Io is new package Ada.Sequential_Io(Byte);

	    Ch: Byte;
	begin
	    Byte_Io.Read(Text_Io.Standard_Input, Ch);
	    -- process the byte;
	end;

which clearly doesn't work, since Text_Io.Standard_Input is most
definitely not a Byte_Io.File_Type.  So I try

	Byte_Io.Read(Byte_Io.File_Type(Text_Io.Standard_Input), Ch);

at which Gnat reports "ambiguous operand", since Standard_Input
is either a Text_Io.File_Type or a Text_Io.File_Access and Gnat
can't figure out which I want.  So I try

	Byte_Io.Read(Byte_Io.File_Type(Text_Io.File_Type'(Text_Io.Standard_Input)), Ch);

which is certainly a mouthful, but also doesn't work.  Gnat
reports

	invalid conversion, not compatible with private type
		"Ada.Text_Io.File_Type" 

thereby informing me that, now that it knows what I want to do,
it's decided that I can't get there from here.

So, what, if anything, is the magic incantation to read raw data
from standard input?

- David




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

end of thread, other threads:[~1996-07-09  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-07-09  0:00 Reading sequential data from Ada.Text_Io.Standard_Input? David J. Fiander
1996-07-09  0:00 ` Michael Paus
1996-07-09  0:00 ` Robert Dewar
1996-07-09  0:00 ` Robert A Duff

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