From: Erik Sigra <sigra@home.se>
Subject: Re: Read booleans from streams
Date: Mon, 25 Mar 2002 12:21:09 +0100
Date: 2002-03-25T12:21:09+01:00 [thread overview]
Message-ID: <mailman.1017055022.31045.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: <pan.2002.03.24.19.58.38.934664.18394@jps-nospam.net>
m�ndagen den 25 mars 2002 04.57 skrev du:
> I think the problem is in the read procedure. It sees an array of 8
> elements, so wants to read 8 bytes. I think you need a 'Read wrapper to
> read a single byte (type Byte is mod 2**8), and then do an
> Unchecked_Conversion:
>
> function To_Boolean_Aggregate is new
> Ada.Unchecked_Conversion(Byte,Boolean_Aggregate);
>
> procedure Read_Boolean_Aggregate
> (Stream : Stream_Access; Data : in out Boolean_Aggregate) is
>
> Item : Byte;
> begin
> Byte'Read (Stream, Item);
> Data := To_Boolean_Aggregate (Item);
> end Read_Boolean_Aggregate;
>
> ...
>
> while not End_Of_File (File_Type) loop
> Read_Boolean_Aggregate (Stream, Data);
>
> ...
> end loop;
Thanks, it works!
The only problem is that it seems impossible to state
"for Boolean_Aggregate'Read use Boolean_Aggregate_Read;".
next prev parent reply other threads:[~2002-03-25 11:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-24 23:18 Read booleans from streams Erik Sigra
2002-03-25 3:57 ` Eric G. Miller
2002-03-25 11:21 ` Erik Sigra [this message]
[not found] ` <200203251121.g2PBL9401018@a77.ib.student.liu.se>
2002-03-25 16:00 ` sk
[not found] <200203242318.g2ONIkc12876@a77.ib.student.liu.se>
2002-03-25 2:05 ` sk
[not found] ` <3C9E85F6.8EDF3AAD@myob.com>
2002-03-25 10:46 ` Erik Sigra
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox