From: davidf@worf.mks.com (David J. Fiander)
Subject: Reading sequential data from Ada.Text_Io.Standard_Input?
Date: 1996/07/09
Date: 1996-07-09T00:00:00+00:00 [thread overview]
Message-ID: <4rsibv$2mo@ia.mks.com> (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
next reply other threads:[~1996-07-09 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-09 0:00 David J. Fiander [this message]
1996-07-09 0:00 ` Reading sequential data from Ada.Text_Io.Standard_Input? Robert A Duff
1996-07-09 0:00 ` Michael Paus
1996-07-09 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox