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-Thread: 103376,c31849ae55c4fb65 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns13feed!worldnet.att.net!attbi_s22.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Thunderbird 1.5.0.8 (Windows/20061025) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Strings and errors... (gnat) References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <_Gubh.1081253$084.375403@attbi_s22> NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s22 1164867386 12.201.97.213 (Thu, 30 Nov 2006 06:16:26 GMT) NNTP-Posting-Date: Thu, 30 Nov 2006 06:16:26 GMT Date: Thu, 30 Nov 2006 06:16:26 GMT Xref: g2news2.google.com comp.lang.ada:7754 Date: 2006-11-30T06:16:26+00:00 List-Id: Benjamin Place wrote: > tmp is defined as 30 characters long - you've tried to assign a 14 character string to it. > > You need to pad tmp with 16 more characters. Or use Unbounded strings (Ada.Strings.Unbounded). Or assign to a slice of Tmp: Tmp (1 .. 14) := Buf (13 .. 26); More generally: Tmp (1 .. Last - First + 1) := Buf (First .. Last); In this case, though, you probably want to keep track of the last meaningful Character in Tmp, which means you're essentially using a bounded string. If you do very much of this, it's probably easier to just used a Bounded_String, which keeps track of that for you. What the OP seems to be missing is that, in Ada, String is a 1D array type, no different from any other 1D array type. There is nothing special about String (or any string type). The OP seems to be used to a language in which strings are special; apparently they behave like bounded strings in that language (in some languages, this is true for all arrays). -- Jeff Carter "Have you gone berserk? Can't you see that that man is a ni?" Blazing Saddles 38