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.8 required=5.0 tests=BAYES_00,TRACKER_ID autolearn=no 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 15:28:42 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <274dc49b-b7cd-4eef-b333-34bae665c992@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Fri, 4 Dec 2015 22:26:18 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="caa759af2a9c666aec02942f6fe5abd6"; logging-data="16084"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX189UmVfSKaLepUYd34goM+FJlRhMqYpXgw=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 In-Reply-To: <274dc49b-b7cd-4eef-b333-34bae665c992@googlegroups.com> Cancel-Lock: sha1:8RSiXi5ll2c7lTJyUvnxyj1dmO8= X-Enigmail-Draft-Status: N1110 Xref: news.eternal-september.org comp.lang.ada:28648 Date: 2015-12-04T15:28:42-07:00 List-Id: On 12/04/2015 02:21 PM, Laurent wrote: > > 1st read: 0123456789 > append to the buffer which is empty so content of buffer is: 0123456789 > > 2nd read: abcdefghijklmnopqrstuvwxyz > append to buffer so it becomes: 0123456789abcdefghijklmnopqrstuvwxyz > > 3rd read: ABCDEFGHIJKLMNOPQRSTUVWXYZ > append to buffer so it would be: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ This is what your code does for me, compiled with GNAT 4.9.2 under Linux Mint Debian Edition. One possible explanation is that your file was produced by a Windows system, and you're running your program on a Unix-based platform. In that case, Get_Line will return a string with a CR at the end. When displayed, the CR will return the cursor to the beginning of the line. So you begin by outputting Buffer after append: 0123456789 You then output the CR, and the cursor returns to the beginning of the line. Then you output abcdefghijklmnopqrstuvwxyz which overwrites everything already displayed through the '4'. -- Jeff Carter "Well, a gala day is enough for me. I don't think I can handle any more." Duck Soup 93