comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Weird string I/O problem
Date: Wed, 26 Nov 2008 09:25:19 +0100
Date: 2008-11-26T09:25:16+01:00	[thread overview]
Message-ID: <1sr39d4v1hgxy$.u9da4qgbl1rp.dlg@40tude.net> (raw)
In-Reply-To: 1316b4ad-bdd9-4a1f-82d5-07231e6872af@s20g2000yqh.googlegroups.com

On Tue, 25 Nov 2008 23:38:04 -0800 (PST), christoph.grein@eurocopter.com
wrote:

> I meant
> Here, Get_Line consumes the rest of the previous input up to and
> including the <Return>, in your case the rest is empty.
> (If you had entered 12.3 xxx<Return>, the contents of UBS would be
> " xxx".)

And a little advise for text processing:

1. Never read data items directly from files. Do lines first, as strings.
Then parse obtained strings.

2. Take care to remove trailing LF and CR at the line end. (You never know
if the text file do obey UNIX or MS-DOS conventions.)

3. Always verify that the whole line was parsed.

4. Do not use Unbounded_String, it is just an unnecessary overhead. Ada
2005 has Get_Line returning String. (In high-integrity software use Ada
95's Get_Line, that with the line size limited).

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2008-11-26  8:25 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-26  5:52 Weird string I/O problem Jerry
2008-11-26  7:24 ` christoph.grein
2008-11-26  7:38   ` christoph.grein
2008-11-26  8:25     ` Dmitry A. Kazakov [this message]
2008-11-26  9:07   ` Jean-Pierre Rosen
2008-11-26 15:21     ` John McCormick
2008-11-26 15:56     ` Adam Beneschan
2008-11-27 10:13       ` Jean-Pierre Rosen
2008-12-01 16:17         ` Adam Beneschan
2008-11-27  4:46 ` Jerry
2008-11-27 10:27   ` Jean-Pierre Rosen
2008-12-01 19:47 ` anon
2008-12-02  5:44   ` christoph.grein
2008-12-02  6:55     ` anon
2008-12-02  7:53       ` christoph.grein
2008-12-02 16:39         ` Adam Beneschan
2008-12-03  9:16           ` anon
2008-12-03 10:42             ` christoph.grein
2008-12-03 12:21               ` John B. Matthews
2008-12-04  0:15               ` anon
2008-12-04  7:31                 ` christoph.grein
2008-12-04  7:56                   ` Ludovic Brenta
2008-12-04  8:46                     ` Georg Bauhaus
2008-12-03 11:35             ` stefan-lucks
2008-12-04  0:27               ` anon
2008-12-04  8:58                 ` stefan-lucks
2008-12-04 22:54                   ` anon
2008-12-05  9:06                     ` Georg Bauhaus
replies disabled

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