comp.lang.ada
 help / color / mirror / Atom feed
* GET LINE
@ 1999-07-02  0:00 babefan
  1999-07-02  0:00 ` czgrr
  0 siblings, 1 reply; 37+ messages in thread
From: babefan @ 1999-07-02  0:00 UTC (permalink / raw)


how do you use the get line?  have a string to display.
thanks




^ permalink raw reply	[flat|nested] 37+ messages in thread
* Get_Line
@ 2002-10-29 20:24 Justin Birtwell
  2002-10-29 20:55 ` Get_Line David C. Hoos
                   ` (3 more replies)
  0 siblings, 4 replies; 37+ messages in thread
From: Justin Birtwell @ 2002-10-29 20:24 UTC (permalink / raw)


Hi,

I'm having some strange behavior with Get_Line.  In a procedure called
GetData I call Get_Line to receive input from the command line. The first
time this function is called it behaves fine prompting the user for input.
The second time it runs  the execution passes through Get_Line and no prompt
appears on the command line.  Upon doing a little research in the Ref Man.
I found a statement that talks about if Get_Line finds a line terminator it
automatically returns.  But how can this be?   Here's the statement from the
RM.

<< A string read by Get or written by Put can extend over several lines. An
implementation is allowed to assume that certain external files do not
contain page terminators, in which case Get_Line and Skip_Line can return as
soon as a line terminator is read. >>

But I'm not reading from a file?  I'm reading from the command line?  Does
anyone understand this behavior?

Sincerely,
Justin

P.s.  Here's a few statements leading up to the problem...

   procedure Getdata(P_Num_Of_Points: out Natural) is
      Last:Natural:=0;
      Buffer:String(1..80):=(1..80=>Character'val(0));
      l_Num:Integer;
      --Answer:Character;
   begin

      --get input
      --are there any invalid characters
      --is it a valid number anyway?
      --does the user want to use this number?
         Ada.Text_Io.Put_Line("Enter between 1 and 6 Balloons to create in
the box. ");
      loop
         begin

                                           ---This line gets skipped
returning with an empty buffer!!!!!!!
         if Jb.Stringfunctions.Is_Integer(Buffer(Buffer'First..Last)) then







^ permalink raw reply	[flat|nested] 37+ messages in thread
* get_line
@ 1998-06-05  0:00 Steve Dyrdahl
  1998-06-05  0:00 ` get_line Samuel Mize
  1998-06-06  0:00 ` get_line Dale Stanbrough
  0 siblings, 2 replies; 37+ messages in thread
From: Steve Dyrdahl @ 1998-06-05  0:00 UTC (permalink / raw)



I have a problem that seems fairly simple.

Suppose the following:

type name_array is array (1..10) of string (1..15);

names  : name_array;
length : natural;


Then:

for I in name_array'range loop
   get_line (names(I),length);
end loop;


The problem (on our Unix system anyway) is that if the user types more
characters than the string will hold.  The "leftover" characters are still
left in the input buffer and will be read on the next execution of the
loop.

I am wondering if there is a clean solution for flushing the input buffer
to avoid this problem.  Obviously I could write my own version of get_line
to avoid this problem, but I try to avoid reinventing the wheel whenever
possible.

Steve Dyrdahl





^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2002-11-02  0:28 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-02  0:00 GET LINE babefan
1999-07-02  0:00 ` czgrr
  -- strict thread matches above, loose matches on Subject: below --
2002-10-29 20:24 Get_Line Justin Birtwell
2002-10-29 20:55 ` Get_Line David C. Hoos
2002-10-30  1:30 ` Get_Line Jeffrey Carter
2002-10-30 13:33   ` Get_Line Justin Birtwell
2002-10-30 14:40     ` Get_Line Preben Randhol
2002-10-30 17:09     ` Get_Line Jean-Pierre Rosen
2002-10-30 18:08     ` Get_Line Jeffrey Carter
2002-10-30 22:42       ` Get_Line Robert A Duff
2002-10-31  0:26         ` Get_Line Chad R. Meiners
2002-10-31  0:44           ` Get_Line Robert A Duff
2002-10-31 10:32             ` Get_Line John English
2002-10-31 11:30               ` Get_Line Preben Randhol
2002-10-31 13:10                 ` Get_Line John English
2002-10-31 17:39             ` Get_Line Warren W. Gay VE3WWG
2002-10-31 21:46             ` Get_Line Chad R. Meiners
2002-11-01 16:59               ` Get_Line Robert A Duff
2002-11-01 21:04                 ` Get_Line Chad R. Meiners
2002-11-01 23:32                   ` Get_Line Matthew Heaney
2002-11-02  0:28                     ` Get_Line Chad R. Meiners
2002-10-31  8:53       ` Get_Line Preben Randhol
2002-10-31 18:04         ` Get_Line Jeffrey Carter
2002-11-01 11:18           ` Get_Line Preben Randhol
2002-10-30 14:44 ` Get_Line Preben Randhol
2002-10-31 21:55 ` Get_Line Matthew Heaney
1998-06-05  0:00 get_line Steve Dyrdahl
1998-06-05  0:00 ` get_line Samuel Mize
1998-06-17  0:00   ` get_line Hans Marqvardsen
1998-06-18  0:00     ` get_line John McCabe
1998-06-21  0:00       ` get_line Robert Dewar
1998-06-06  0:00 ` get_line Dale Stanbrough
1998-06-06  0:00   ` get_line Robert Dewar
1998-06-06  0:00   ` get_line Matthew Heaney
1998-06-07  0:00     ` get_line Dale Stanbrough
1998-06-06  0:00       ` get_line Matthew Heaney
1998-06-18  0:00     ` get_line Robert I. Eachus

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