comp.lang.ada
 help / color / mirror / Atom feed
From: Preben Randhol <randhol+news@pvv.org>
Subject: Re: Newbie question on Ada TExt_IO
Date: Fri, 4 Oct 2002 18:02:23 +0000 (UTC)
Date: 2002-10-04T18:02:23+00:00	[thread overview]
Message-ID: <slrnaprltf.138.randhol+news@kiuk0156.chembio.ntnu.no> (raw)
In-Reply-To: slrnaprlqa.138.randhol+news@kiuk0156.chembio.ntnu.no

On Fri, 4 Oct 2002 18:00:42 +0000 (UTC), Preben Randhol wrote:
> On Fri, 04 Oct 2002 17:49:26 GMT, Justin Birtwell wrote:
>> Steve,
>> 
>><<, I would read the value
>> into a string using something like Text_Io.Read_Line with the string
>> ridiculously large (maybe 1..256). >>
>> I couldn't find the package Text_IO.Read_Line did you mean Get_Line?
> 
> I think he meant to define a Read_Line like below (I called it
> Get_Whole_Line)
> 
>    procedure Get_Whole_Line
>       (File : in     File_Type;
>        Item :    out String;
>        Last :    out Natural)
>    is
>    begin
>       Get_Line (File => File, Item => Item, Last => Last);
>       if Last = Item'Last then
>          --  The line was longer than allowed, skipping the rest.
>          --  Can also raise an exception if necessary.
>          Skip_Line (File => File);
>       else
>          Fixed.Delete (Source => Item, From => Last + 1, Through => Item'Last);
>       end if;
> 
>       Line_Number := Line_Number + 1;
>    end Get_Whole_Line;


Note I use my procedure to read from a file so you can remove the File
part if you are reading from stdin.

-- 
Ada95 is good for you.
http://libre.act-europe.fr/Software_Matters/02-C_pitfalls.pdf



  reply	other threads:[~2002-10-04 18:02 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-03 18:20 Newbie question on Ada TExt_IO Justin
2002-10-03 18:50 ` Matthew Heaney
2002-10-03 19:05 ` Jeffrey Carter
2002-10-03 19:35 ` David C. Hoos
2002-10-03 19:35 ` tmoran
2002-10-03 19:43 ` Preben Randhol
2002-10-03 19:55   ` Matthew Heaney
2002-10-03 20:07     ` Preben Randhol
2002-10-04  2:42 ` SteveD
2002-10-04 17:49   ` Justin Birtwell
2002-10-04 18:00     ` David C. Hoos
2002-10-04 18:04       ` Preben Randhol
2002-10-04 18:00     ` Preben Randhol
2002-10-04 18:02       ` Preben Randhol [this message]
2002-10-04 18:34     ` tmoran
2002-10-04 17:34 ` Justin Birtwell
2002-10-04 17:58   ` Preben Randhol
2002-10-04 18:13   ` tmoran
2002-10-04 20:07   ` Jeffrey Carter
2002-10-07  8:26     ` Fraser Wilson
2002-10-07 19:44       ` Jeffrey Carter
2002-10-05  2:43   ` SteveD
2002-10-05  5:25     ` tmoran
  -- strict thread matches above, loose matches on Subject: below --
2002-10-07  6:01 Grein, Christoph
2002-10-07  8:27 Grein, Christoph
2002-10-07 11:48 ` Fraser Wilson
2002-10-07 12:46   ` Robert A Duff
replies disabled

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