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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,463c997594f91391 X-Google-Attributes: gid103376,public From: kilgallen@eisner.decus.org (Larry Kilgallen) Subject: Re: How to get a character? Date: 1999/04/12 Message-ID: <1999Apr12.074300.1@eisner>#1/1 X-Deja-AN: 465440074 X-Nntp-Posting-Host: eisner.decus.org References: <370EE07D.67C71458@dave-world.net> <3711753C.A665E406@spam.innocon.com> X-Trace: news.decus.org 923917398 17867 KILGALLEN [192.67.173.2] Organization: LJK Software Reply-To: Kilgallen@eisner.decus.org.nospam Newsgroups: comp.lang.ada Date: 1999-04-12T00:00:00+00:00 List-Id: In article <3711753C.A665E406@spam.innocon.com>, Jeff Carter 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