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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,be28f9de3e9d4e8f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-16 11:16:01 PST Path: supernews.google.com!sn-xit-02!supernews.com!isdnet!newsfeed.icl.net!nntp.news.xara.net!xara.net!gxn.net!news.lattis.xara.net!psiuk-f4!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: Ascii keyword?? Date: Fri, 16 Feb 2001 13:52:46 -0500 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <96jsvv$mr5$1@nh.pace.co.uk> References: <3A8D72D4.BBB57470@blueyonder.co.uk> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 982349631 23397 136.170.200.133 (16 Feb 2001 18:53:51 GMT) X-Complaints-To: newsmaster@pace.co.uk NNTP-Posting-Date: 16 Feb 2001 18:53:51 GMT X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-Mimeole: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: supernews.google.com comp.lang.ada:5310 Date: 2001-02-16T18:53:51+00:00 List-Id: "Richard" wrote in message news:3A8D72D4.BBB57470@blueyonder.co.uk... > ok am new to this ada thing, so is there a package and/or keyword i can > use to convert a decimal number to a acsii character and vice versa > It's pretty simple. There are things in Ada called "Attributes" which can be extremely handy for a wide variety of things. In this case, there are two attributes which are defined for all discrete types (characters being a discrete type). They are 'Pos and 'Val and they work like function calls. Here's basically how you would use them. My_Int : Integer := 0 ; My_Char : Character := ' ' ; ... My_Char := Character'Val (33) ; -- Gives My_Char the ascii character '!' My_Int := Character'Pos ('&') ; -- Gives My_Int the value 38. A good example of this is in the appendix A.3.3 of the ARM. (This is where the Latin_1 character set is defined.) If you don't have an ARM handy, look at: http://www.adapower.org/ under "Reference" for the on-line HTML version of the ARM. While the ARM is not the best source for teaching yourself Ada, it is a valuable resource for looking up particulars that you may come across in reading other texts. Good luck with Ada! MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/