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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,CP1252 X-Google-Thread: 103376,948c8b1c8730d81 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-11 18:58:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!rwcrnsc54.POSTED!not-for-mail Message-ID: <3F0F6B08.9050200@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: ATOI References: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@comcast.net X-Trace: rwcrnsc54 1057975086 24.62.164.137 (Sat, 12 Jul 2003 01:58:06 GMT) NNTP-Posting-Date: Sat, 12 Jul 2003 01:58:06 GMT Organization: Comcast Online Date: Sat, 12 Jul 2003 01:58:06 GMT Xref: archiver1.google.com comp.lang.ada:40219 Date: 2003-07-12T01:58:06+00:00 List-Id: Riccardo Fulcoli wrote: > HI! > I'm having problems reguarding the input/output from files in text mode. > Exactly I would like to read a field as a string of 50 characters(and for > that i'm using the redirection of the input) and after that to convert it in > a number (an integer). > i.e. I'm looking for a function like the C "atoi". > Of course I already know that the content of the field is a numeric one but > the unchecked conversions seems not to be good at the purpose. > Is there someone that could help me??? > Thanks ;) > > Riccardo Why would you want to do an Unchecked_Conversion. See Ada.Text_IO, or Ada.Integer_Text_IO. But if you have already read in a string you can use the attribute function Integer'Value(Some_String). Note that the function will ignore leading and trailing spaces, but otherwise can raise an exception which may not be what you want. See RM 3.5(52) -- Robert I. Eachus �In an ally, considerations of house, clan, planet, race are insignificant beside two prime questions, which are: 1. Can he shoot? 2. Will he aim at your enemy?� -- from the Laiden novels by Sharon Lee and Steve Miller.