From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.141.78 with SMTP id p75mr4138527iod.12.1471739812356; Sat, 20 Aug 2016 17:36:52 -0700 (PDT) X-Received: by 10.157.19.69 with SMTP id q5mr964910otq.0.1471739812331; Sat, 20 Aug 2016 17:36:52 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!f6no11625771ith.0!news-out.google.com!d130ni41629ith.0!nntp.google.com!f6no11625760ith.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 20 Aug 2016 17:36:52 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:18f:900:8350:55e9:c515:61e6:b20f; posting-account=AvekzAoAAABj-TclKcOWQmXwA49MFPGX NNTP-Posting-Host: 2601:18f:900:8350:55e9:c515:61e6:b20f References: <07632b3f-f419-4865-a8f8-01b568a6883e@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Why does this input get "skipped"? From: John Smith Injection-Date: Sun, 21 Aug 2016 00:36:52 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:31476 Date: 2016-08-20T17:36:52-07:00 List-Id: 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?