comp.lang.ada
 help / color / mirror / Atom feed
From: christoph.grein@eurocopter.com
Subject: Re: Weird string I/O problem
Date: Mon, 1 Dec 2008 21:44:34 -0800 (PST)
Date: 2008-12-01T21:44:34-08:00	[thread overview]
Message-ID: <6d9d4120-3af9-42c6-b3e9-768418948084@t3g2000yqa.googlegroups.com> (raw)
In-Reply-To: 7bXYk.50433$_Y1.8162@bgtnsc05-news.ops.worldnet.att.net

On 1 Dez., 20:47, a...@anon.org (anon) wrote:
> --
> -- Build your own input routine.  Example:
> --
> with Ada.Characters.Latin_1 ; -- Needed for control chars.
> use Ada.Characters.Latin_1 ;
>
> -- ...
>   char : character ;
>   input_string : String ( 1..80 ) ;
>   last : natural ;
>
> -- ...
>
> input_string := ( others => nul ) ;
> for index in input_string'Range loop
>   Get ( char ) ;
>   exit when char = CR or char = LF ;

Does anon ever read the RM? See A.10.7(1..3):
After skipping any line terminators and any page terminators, reads
the next character from the
specified input file and returns the value of this character in the
out parameter Item.

Also A.9(8): Effect of input (Get) ... of control characters ... is
not specified.

This tries to do what Get_Line is for - and is wrong!

>   input_string ( index ) := char ;
>   Last := Index ;  
> end loop
>
>   -- valid data is input_string ( 1 .. last ) ; with no term control characters
>
> -- ...



  reply	other threads:[~2008-12-02  5:44 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
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 [this message]
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