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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Problem with Unbounded Strings Date: Fri, 4 Dec 2015 11:08:06 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Fri, 4 Dec 2015 18:05:42 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="caa759af2a9c666aec02942f6fe5abd6"; logging-data="16191"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19UEK1yMa8eZ9YrpcDeF3Wfrx1ky9NWSxo=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: Cancel-Lock: sha1:+PrOkKZzuFUah9S+TJVHD/fqQBw= X-Enigmail-Draft-Status: N1110 Xref: news.eternal-september.org comp.lang.ada:28635 Date: 2015-12-04T11:08:06-07:00 List-Id: I would ignore Kazakov's comments. While he prefers to avoid unbounded strings, many others don't, so if the characteristics of Unbounded_String are suitable for your project there is no reason not to use them. You can't use a case statement because you're comparing strings, and case statements can only be used for discrete types. On 12/04/2015 08:49 AM, Laurent wrote: > procedure Read_Message (File : in Ada.Text_IO.File_Type; > ... > while not Ada.Text_IO.End_Of_File (Log_File) loop What is Log_File? > U_B.Append (Source => Buffer, > New_Item => Line (5 .. Line'Last)); I see nothing wrong with this use of append. If it's possible that 5 > Line'Last then you would be appending a null string, which would not change the value of Buffer. It would be nice if you could reduce your example to eliminate the irrelevant parts and provide some input and corresponding output (and expected output) that demonstrates your problem. Otherwise I'm unable to to offer any advice. Certainly I've made extensive use of Unbounded_String and never encountered any problem with Append, so you probably have a logic problem. -- Jeff Carter "Well, a gala day is enough for me. I don't think I can handle any more." Duck Soup 93