* Trouble with Ada.Streams.Stream_Element
@ 2005-04-19 23:27 Frank Gerlach
2005-04-19 23:46 ` Eric Jacoboni
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Frank Gerlach @ 2005-04-19 23:27 UTC (permalink / raw)
It is defined as follows:
type Stream_Element is mod 2 ** Standard'Storage_Unit;
I would like to convert it to an INTEGER.
How do I do this ?
Thanks for helping a newbie !
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Trouble with Ada.Streams.Stream_Element
2005-04-19 23:27 Trouble with Ada.Streams.Stream_Element Frank Gerlach
@ 2005-04-19 23:46 ` Eric Jacoboni
2005-04-20 0:05 ` Stephen Leake
2005-04-20 1:21 ` Georg Bauhaus
2 siblings, 0 replies; 4+ messages in thread
From: Eric Jacoboni @ 2005-04-19 23:46 UTC (permalink / raw)
frankgerlach@gmail.com (Frank Gerlach) writes:
> type Stream_Element is mod 2 ** Standard'Storage_Unit;
> I would like to convert it to an INTEGER.
> How do I do this ?
What about: Integer(A_Stream_Element) ?
--
�ric Jacoboni, n� il y a 1417398326 secondes
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Trouble with Ada.Streams.Stream_Element
2005-04-19 23:27 Trouble with Ada.Streams.Stream_Element Frank Gerlach
2005-04-19 23:46 ` Eric Jacoboni
@ 2005-04-20 0:05 ` Stephen Leake
2005-04-20 1:21 ` Georg Bauhaus
2 siblings, 0 replies; 4+ messages in thread
From: Stephen Leake @ 2005-04-20 0:05 UTC (permalink / raw)
To: Frank Gerlach; +Cc: comp.lang.ada
frankgerlach@gmail.com (Frank Gerlach) writes:
> It is defined as follows:
> type Stream_Element is mod 2 ** Standard'Storage_Unit;
> I would like to convert it to an INTEGER.
> How do I do this ?
Stream_Element is already a perfectly good numeric type; why do you
want to convert it to another numeric type?
If it's because you want to write it to a text file, instantiating
Ada.Text_IO.Modular_IO is better.
But if you insist, this is just a numeric type conversion:
A : Stream_Element := 2;
B : Integer := Integer (A);
--
-- Stephe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Trouble with Ada.Streams.Stream_Element
2005-04-19 23:27 Trouble with Ada.Streams.Stream_Element Frank Gerlach
2005-04-19 23:46 ` Eric Jacoboni
2005-04-20 0:05 ` Stephen Leake
@ 2005-04-20 1:21 ` Georg Bauhaus
2 siblings, 0 replies; 4+ messages in thread
From: Georg Bauhaus @ 2005-04-20 1:21 UTC (permalink / raw)
Frank Gerlach wrote:
> It is defined as follows:
> type Stream_Element is mod 2 ** Standard'Storage_Unit;
> I would like to convert it to an INTEGER.
> How do I do this ?
>
> Thanks for helping a newbie !
Have you had a chance to look at some stream examples?
For example, you could use
Integer'read(your_input_stream, your_integer_variable);
Usually a program just reads from a stream, it doesn't
have to look at individual bits.
Or are you implementing a new stream class?
-- Georg
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-04-20 1:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-19 23:27 Trouble with Ada.Streams.Stream_Element Frank Gerlach
2005-04-19 23:46 ` Eric Jacoboni
2005-04-20 0:05 ` Stephen Leake
2005-04-20 1:21 ` Georg Bauhaus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox