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!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Reading data from file Date: Wed, 05 Mar 2014 14:00:55 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: <9b780534-04fb-43c8-b8de-1610421c471d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 5 Mar 2014 21:00:57 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="bd5e647da89610f9b7b0763dacbc65f9"; logging-data="23370"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX186tCrA61Z/ZVB7UZWawLk5xKn3S7+n648=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: Cancel-Lock: sha1:BMwq49z93mfE5tNHRVSAk1FnyMg= Xref: news.eternal-september.org comp.lang.ada:18784 Date: 2014-03-05T14:00:55-07:00 List-Id: On 03/05/2014 01:33 PM, Laurent wrote: > Am Dienstag, 4. März 2014 22:42:37 UTC+1 schrieb Niklas Holsti: > >> So the problem is that after reading the ID you must >> move the read point to the start of the "name" line. >> Add a Skip_Line between the Get(ID) and >> the Get_Line(Name). > > The Skip_Line works only if I use it together with: > > Ada.Text_IO.Get (File => Import_File, Item => Temp_Record.Name); > > and this only if I put spaces after "test" to a total length of 30 chars. If you reread what Holsti wrote, and put the Skip_Line where he said to put it, not where you're putting it, it should work fine. > Until now I like Ada very much but this odd behavior > of Ada.Text_IO.Get/Get_Line drives me crazy. > > The integer/enumeration getters aren't so picky. Most of us who use Ada professionally rarely use those packages for input. Instead, we get a line at a time using Get_Line and convert values using 'Value, with an exception handler to handle incorrect input. This avoids line-end problems such as you have encountered. -- Jeff Carter "My mind is aglow with whirling, transient nodes of thought, careening through a cosmic vapor of invention." Blazing Saddles 85