comp.lang.ada
 help / color / mirror / Atom feed
From: rieachus@comcast.net
Subject: Re: Why does this input get "skipped"?
Date: Mon, 22 Aug 2016 15:18:38 -0700 (PDT)
Date: 2016-08-22T15:18:38-07:00	[thread overview]
Message-ID: <2d96f593-e1d3-43da-9a6a-16e8ce0f675b@googlegroups.com> (raw)
In-Reply-To: <e0e14ec6-0f53-412e-a089-c512d37fc026@googlegroups.com>

On Saturday, August 20, 2016 at 8:36:53 PM UTC-4, John Smith wrote: 
> 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?

Because Text_IO was developed thirty years ago to deal with systems that don't exist today?

BTW, always reading a line (Get_Line) at a time into a buffer, and then reading from the line with a fairly complex scanner is the way almost all Ada compilers written in Ada work.  Why?  It allows you to do more sophisticated error recognition/correction than just throwing away the bad input.

Get_Line, Skip_Line, and Set_Col(1) should all get you to the same place. (Except for some sequences involving End_Of_Page marks.) But Get_Line into a buffer allows you to at a minimum tell the user what he did wrong:

'Pinc' is not a recognized color.

   ...is an error message that shouldn't raise the user's blood pressure.  Of course, he or she might rage at "'Puce' is not a recognized color," but at least he or she will be reacting to your taste in colors, not potential input issues. ;-)  

  parent reply	other threads:[~2016-08-22 22:18 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
2016-08-22  5:00       ` J-P. Rosen
2016-08-22 22:18       ` rieachus [this message]
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