comp.lang.ada
 help / color / mirror / Atom feed
From: Martin <martin.dowie@btopenworld.com>
Subject: Re: BASIC_NUM_IO
Date: Mon, 1 Jun 2009 01:18:09 -0700 (PDT)
Date: 2009-06-01T01:18:09-07:00	[thread overview]
Message-ID: <f9720533-9f52-4d66-99b0-f8aa734d8856@z19g2000vbz.googlegroups.com> (raw)
In-Reply-To: 78hfulF1m321pU2@mid.individual.net

On Jun 1, 8:57 am, Georg <nob...@nowhere.com> wrote:
> Hi All,
>
> in my Ada books I find the with-clause "with BASIC_NUM_IO; use
> BASIC_NUM_IO".
>
> The following program
>
> with basic_num_io; use basic_num_io;
>
> procedure test_ranges is
> begin
>    put_line(short_integer'size);
> end test_ranges;
>
> does not compile because the compiler complaints that the package
> "basic_num_io" does not exist.
>
> Is there a replacement for this package in GNAT? How can I print number
> on the screen instead?
>
> Regards
>
> Georg

You could use Ada.Text_IO.Integer_IO and instantiate it with the type
of the data item you want to 'Put_Line'. This gets rather tedious if
you more than 2 types! ;-)

The alternative is to use 'Image, e.g.

with Ada.Text_IO; use Ada.Text_IO;
procedure Demo is
   I : Integer := 42;
begin
   Put_Line (Integer'Image (I));
end Demo;

The return type from 'Size if 'universal_integer' and you can't say
"universal_integer'Image (...") but luckily enough an "Integer'Image
(...)" will work for that.

Cheers
-- Martin




  parent reply	other threads:[~2009-06-01  8:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-01  7:57 BASIC_NUM_IO Georg
2009-06-01  8:13 ` BASIC_NUM_IO Pascal Obry
2009-06-01  8:18 ` Martin [this message]
2009-06-01  8:18 ` BASIC_NUM_IO anon
replies disabled

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