comp.lang.ada
 help / color / mirror / Atom feed
From: "Dr. Michael Paus" <paus@ib-paus.com>
Subject: Re: Get Integer into Enumeration_IO doesn't work
Date: Sun, 17 Nov 2002 09:38:10 +0100
Date: 2002-11-17T08:38:11+00:00	[thread overview]
Message-ID: <ar7khj$r18$1@news.online.de> (raw)
In-Reply-To: b740187a.0211160217.658dc54@posting.google.com

Amir Shaked wrote:
> Hello,
> 
> The following code compiles and links
> but fails on DATA_ERROR in run-time.
> Can you tell me why?
> 
> with Text_IO;
> procedure PrintInt
> is
>    Num  : Integer;
>    package EnumIO is new Text_IO.Enumeration_IO(Integer);
> begin
>    Text_IO.Put_Line ("Enter Num:");
>    EnumIO.Get (Num);
> end PrintInt;

If you do not need any specific formatting you can simply write:

with Text_IO;
procedure PrintInt
is
    Num  : Integer := 4711; -- You have to assign some value
begin
    Text_IO.Put_Line ("Enter Num:" & Integer'Image(Num));
end PrintInt;

In this case you do not need any instantiations at all.

Michael




  parent reply	other threads:[~2002-11-17  8:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-16 10:17 Get Integer into Enumeration_IO doesn't work Amir Shaked
2002-11-16 11:13 ` David C. Hoos, Sr.
2002-11-17  8:38 ` Dr. Michael Paus [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-11-18  6:38 Grein, Christoph
2002-11-18 14:28 ` Peter Richtmyer
replies disabled

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