comp.lang.ada
 help / color / mirror / Atom feed
From: kilgallen@eisner.decus.org (Larry Kilgallen)
Subject: Re: How to get a character?
Date: 1999/04/12
Date: 1999-04-12T00:00:00+00:00	[thread overview]
Message-ID: <1999Apr12.074300.1@eisner> (raw)
In-Reply-To: 3711753C.A665E406@spam.innocon.com

In article <3711753C.A665E406@spam.innocon.com>, Jeff Carter <spam.carter.not@spam.innocon.com> writes:
> Again, I see people recommending Ada.Text_Io.Get_Line as the way to
> perform the "Press Enter [or Return] to continue:" function. This is
> incorrect. When, in response to this message, the user types enough
> characters to fill the Item parameter to Get_Line, the program will
> continue before the user presses Enter [or Return]. If the user
> mistakenly types ahead, this can be a significant problem.
> 
> In Ada terms, the desired behavior is for the program to wait until the
> user inputs a line terminator on standard input, and consume that line
> terminator. The Enter [or Return] key is how the user inputs a line
> terminator. The correct way to wait for and consume a line terminator on
> standard input is
> 
> Ada.Text_Io.Skip_Line;

In human interface terms, the desired behavior is to recognize that
the user who inputs many characters rather than a single carriage return
is probably not synchronized with what the program is asking and intended
those characters to go somewhere useful and may proceed to enter yet some
additional line which would also be used for the wrong purpose.

The program should flush the ambiguous input and signal to the user
that something is wrong through whatever mechanism (bell, reverse video,
speech synthesizer, etc.) is appropriate to the environment.

Larry Kilgallen




      parent reply	other threads:[~1999-04-12  0:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-10  0:00 How to get a character? Ben Barth
1999-04-10  0:00 ` Matthew Heaney
1999-04-10  0:00   ` bglbv
1999-04-10  0:00     ` Matthew Heaney
1999-04-12  0:00       ` Fraser Wilson
1999-04-13  0:00         ` Get_Immediate warning, (was: How to get a character?) JS
1999-04-13  0:00           ` Robert Dewar
1999-04-13  0:00             ` bglbv
1999-04-14  0:00               ` Robert Dewar
1999-04-14  0:00                 ` bglbv
1999-04-15  0:00                   ` Robert Dewar
1999-04-16  0:00                     ` Matthew Heaney
1999-04-16  0:00                       ` Robert Dewar
1999-04-18  0:00                         ` Jean-Pierre Rosen
1999-04-19  0:00                     ` Robert A Duff
1999-04-14  0:00               ` Larry Kilgallen
1999-04-14  0:00             ` JS
1999-04-14  0:00               ` Robert Dewar
1999-04-19  0:00                 ` Robert A Duff
1999-04-10  0:00 ` How to get a character? David C. Hoos, Sr.
1999-04-12  0:00   ` Jeff Carter
1999-04-12  0:00     ` Robert Dewar
1999-04-12  0:00     ` Larry Kilgallen [this message]
replies disabled

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