From: John Smith <yoursurrogategod@gmail.com>
Subject: Re: Why does this input get "skipped"?
Date: Sat, 20 Aug 2016 17:36:52 -0700 (PDT)
Date: 2016-08-20T17:36:52-07:00 [thread overview]
Message-ID: <e0e14ec6-0f53-412e-a089-c512d37fc026@googlegroups.com> (raw)
In-Reply-To: <c10f7c57-5657-4ef4-87e5-285c96610b62@googlegroups.com>
On Saturday, August 20, 2016 at 8:01:16 PM UTC-4, John Smith wrote:
> On Saturday, August 20, 2016 at 7:16:39 PM UTC-4, Jeffrey R. Carter wrote:
> > On 08/20/2016 03:41 PM, John Smith wrote:
> > > This is the snippet in question:
> > > Ada.Text_IO.Put("Delete a value - > ");
> > > String_Input := Ada.Text_IO.Unbounded_IO.Get_Line;
> > > Ada.Text_IO.New_Line;
> > >
> > > The purpose is to have the user enter some string and then keep going. When I ran the above code, I found that I saw "Delete a value - > " being printed, but the program didn't even give me a chance to enter some form of text...
> > >
> > > Why did my code keep running?
> >
> > It's impossible to be sure from the little information given, but the most
> > likely explanation is that there was already a line terminator waiting to be
> > consumed, and the call to Get_Line consumed it (and any characters preceding
> > it). This is often the case after a call to something like Ada.Integer_Text_IO.Get.
> >
> > --
> > Jeff Carter
> > "People called Romanes, they go the house?"
> > Monty Python's Life of Brian
> > 79
>
> Hi, I do have an Ada.Integer_Text_IO.Get above this call (some ways above it.)
>
> How can I clear out that line terminator? Another call to Get_Line, but not save the input?
Adding a Get_Line right after the Integer_Text_IO.Get did get me the result that I want. However, why does this feel like a kludge?
next prev parent reply other threads:[~2016-08-21 0:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-20 22:41 Why does this input get "skipped"? John Smith
2016-08-20 23:16 ` Jeffrey R. Carter
2016-08-21 0:01 ` John Smith
2016-08-21 0:36 ` John Smith [this message]
2016-08-22 5:00 ` J-P. Rosen
2016-08-22 22:18 ` rieachus
2016-08-23 6:22 ` J-P. Rosen
2016-08-24 10:34 ` rieachus
2016-08-21 0:50 ` Jeffrey R. Carter
2016-08-21 1:04 ` John Smith
2016-08-21 4:07 ` Jeffrey R. Carter
2016-08-21 0:00 ` rieachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox