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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a3fe2aac201210c0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 17 Jul 2004 10:52:13 -0500 Date: Sat, 17 Jul 2004 11:52:12 -0400 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: reading a text file into a string References: <40f6bf21@dnews.tpgi.com.au> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.90.114 X-Trace: sv3-vcvNsIxMtmaFuxJlR+mIl8TON6Yw1wSmzsfazZhrdV4EeU1uIO+c26+qNup2gUXL3kYVQi3HqC1Mkhz!laZDs/lkyhCXqaTbur+HmRjOHJvWW0Xia8MzruvjaVh2ENeZPUD8CsC/wCPF/w== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: g2news1.google.com comp.lang.ada:2206 Date: 2004-07-17T11:52:12-04:00 List-Id: Mats Weber wrote: >>Each iteration of the loop, the Buffer contains a CONSTANT String, but > > > It's constant only if you declare it constant, as in > > Buffer: constant String := Get_Line(Somefile); > > >>it is potentially different in length and content every time through. When I woke up this morning my mind told me I'd goofed. What it really said was something like, "You IDIOT, you left out the word length, and worse you emphasized the wrong word." My brain is pretty nasty before it gets its morning fix of caffine. ;-) I meant to say "the Buffer contains a constant LENGTH String..." In Ada 83 you had to declare the String a constant for this idiom to work, but that wasn't what I was trying to say. The magic is that each time through the loop the buffer is exactly the right size to hold the line. If you need to be able to change the length of the buffer though, you have to use Unbounded_String. -- Robert I. Eachus "The flames kindled on the Fourth of July, 1776, have spread over too much of the globe to be extinguished by the feeble engines of despotism; on the contrary, they will consume these engines and all who work them." -- Thomas Jefferson, 1821