From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,27e95161b8834d15 X-Google-Attributes: gid103376,public From: "DuckE" Subject: Re: Character/Integer Conversion Date: 2000/04/02 Message-ID: <38e7fa49.0@news.pacifier.com>#1/1 X-Deja-AN: 605867993 References: <8c3a6e$q5p$1@nnrp1.deja.com> X-Trace: 2 Apr 2000 18:56:25 PST, 198.145.224.76 X-MSMail-Priority: Normal X-Priority: 3 Newsgroups: comp.lang.ada X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Date: 2000-04-02T00:00:00+00:00 List-Id: My answer is an example: function CkSum( msg : String ) return integer is result : integer := 0; begin for ii in msg'range loop result := result + character'pos( msg( ii ) ); end loop; end CkSum; I hope this helps, SteveD wrote in message news:8c3a6e$q5p$1@nnrp1.deja.com... > I am sure this is a simple thing, but I am doing the following... > > I need to create a string of character which will be sent to a scsi > interface. > > I need to convert from a character into a integer so that I can make a > checksum. > > I am giving a basic code version...not verbatum > > msg : string(1..length); > > msg(1) := '~'; -- how do I get the asci value for this character? > msg(2) := 33; > msg(3) : msg(1)'value + msg(2)'value; > > this should more or less add the ascii value of the first character with > the value of the second. > > Any help would be appreciated. > > > Sent via Deja.com http://www.deja.com/ > Before you buy.