comp.lang.ada
 help / color / mirror / Atom feed
From: Alfred Hilscher <Alfred.Hilscher@icn.siemens.de>
Subject: Re: convert integer base10 into base16
Date: Tue, 12 Feb 2002 14:53:56 +0100
Date: 2002-02-12T14:53:56+01:00	[thread overview]
Message-ID: <3C691E74.817FF860@icn.siemens.de> (raw)
In-Reply-To: 8fe5cfbb.0202120405.19690c26@posting.google.com



c-kif-kif wrote:
> 
> I'm shure this question has been answered a million times,
> but i still can't get it right.
> 
> It's easy to convert base10 into base16 :
>         a : integer := 16#A#;
>         a := Integer'Value (Integer'Image(a)); -- result 10
> 
> But how can i convert from base10 to base16 or other ?
> 
> I don't want to write it on screen, so i think it's not with put/get how it works.
> 
> Thanks for any help
> c-kif-kif

You want convert a number to the hex-representation in a string? package
Integer_IO do this for you.

procedure Get(From : in String; Item : out Num; Last : out Positive);

16	Reads an integer value from the beginning of the given string,
following the same rules as the Get procedure that reads an integer
value from a file, but treating the end of the string as a file
terminator. Returns, in the parameter Item, the value of type Num that
corresponds to the sequence input. Returns in Last the index value such
that From(Last) is the last character read.
17	The exception Data_Error is propagated if the sequence input does not
have the required syntax or if the value obtained is not of the subtype
Num.

18	procedure Put(To   : out String;
              Item : in Num;
              Base : in Number_Base := Default_Base);

19	Outputs the value of the parameter Item to the given string,
following the same rule as for output to a file, using the length of the
given string as the value for Width.



  parent reply	other threads:[~2002-02-12 13:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-12 12:05 convert integer base10 into base16 c-kif-kif
2002-02-12 12:10 ` Lutz Donnerhacke
2002-02-12 13:53 ` Alfred Hilscher [this message]
2002-02-12 14:33 ` Georg Bauhaus
2002-02-12 16:45 ` Stephen Leake
2002-02-13  6:17 ` Dale Stanbrough
2002-02-13  9:44   ` c-kif-kif
replies disabled

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