comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Reading data from file
Date: Wed, 05 Mar 2014 14:00:55 -0700
Date: 2014-03-05T14:00:55-07:00	[thread overview]
Message-ID: <lf83a7$mqa$1@dont-email.me> (raw)
In-Reply-To: <df64ee54-cb10-41a6-8521-39a1ca46291b@googlegroups.com>

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

  reply	other threads:[~2014-03-05 21:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-04  9:46 Reading data from file Laurent
2014-03-04 16:17 ` adambeneschan
2014-03-04 18:08 ` Mike H
2014-03-04 21:27   ` Laurent
2014-03-04 21:35     ` Laurent
2014-03-04 21:42     ` Niklas Holsti
2014-03-05 13:59     ` Mike H
2014-03-05 20:33       ` Laurent
2014-03-05 21:00         ` Jeffrey Carter [this message]
2014-03-05 21:13           ` Laurent
2014-03-05 21:25             ` Niklas Holsti
2014-03-05 21:56               ` Laurent
2014-03-06  8:35                 ` Dmitry A. Kazakov
2014-03-07 21:55                   ` Laurent
2014-03-08  6:56                     ` Dmitry A. Kazakov
2014-03-08 21:21                       ` Laurent
2014-03-09 22:39                         ` Laurent
2014-03-10  2:42                           ` Jeffrey Carter
2014-03-11 20:54                             ` Laurent
2014-03-08  9:00                     ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox