comp.lang.ada
 help / color / mirror / Atom feed
From: maysee@m11.sews.wpafb.af.mil (Eric E. Mays 52202)
Subject: converting integer to character
Date: Thu, 17 Oct 91 07:52:10 EDT	[thread overview]
Message-ID: <9110171152.AA02856@m11.sews.wpafb.af.mil> (raw)

Chris,

--   Is there any easy way to convert an integer variable to a character.
--   I am new to ada and would like to do this without a case statement.

     Assuming you are trying to convert an integer 1 to a character 1.
The following statement should work.

        My_char := number'image;

     Where My_char is defined as a string of length 2.  You must allow
an extra character for the sign bit.  Otherwise you will receive a
constraint error.  The above statement would work for integers 0 thru 9,
assuming you defined a string of length 2.

Eric Mays
maysee@m11.sews.wpafb.af.mil

             reply	other threads:[~1991-10-17 11:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-10-17 11:52 Eric E. Mays 52202 [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-10-22 12:39 converting integer to character bu.edu!inmet!inmet!stt
replies disabled

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