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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5cd788f18b560297 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!20g2000yqt.googlegroups.com!not-for-mail From: christoph.grein@eurocopter.com Newsgroups: comp.lang.ada Subject: Re: How to get a key from keyboard Date: Sun, 30 Nov 2008 23:28:34 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <49301282$1_1@news.bluewin.ch> NNTP-Posting-Host: 80.156.44.178 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1228116515 16246 127.0.0.1 (1 Dec 2008 07:28:35 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 1 Dec 2008 07:28:35 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 20g2000yqt.googlegroups.com; posting-host=80.156.44.178; posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1; .NET CLR 3.0.04506.30),gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 webwasher (Webwasher 6.8.2.3963) Xref: g2news1.google.com comp.lang.ada:2843 Date: 2008-11-30T23:28:34-08:00 List-Id: A.10.7 (9) procedure Get_Immediate(File : in File_Type; Item : out Character); procedure Get_Immediate(Item : out Character); (10) Reads the next character, either control or graphic, from the specified File or the default input file. Mode_Error is propagated if the mode of the file is not In_File. End_Error is propagated if at the end of the file. The current column, line and page numbers for the file are not affected. (11) procedure Get_Immediate(File : in File_Type; Item : out Character; Available : out Boolean); procedure Get_Immediate(Item : out Character; Available : out Boolean); (12) If a character, either control or graphic, is available from the specified File or the default input file, then the character is read; Available is True and Item contains the value of this character. If a character is not available, then Available is False and the value of Item is not specified. Mode_Error is propagated if the mode of the file is not In_File. End_Error is propagated if at the end of the file. The current column, line and page numbers for the file are not affected. Thus the former procedures block if there is no character available, the latter ones don't. Try: loop get_immediate (C); Put (Integer'Image (Character'Pos (c))); end loop; Which compiler do you use? If you run the above within GPS, you must press - otherwise GPS obviously does not forward the input to the executable (note that GPS echoes the input and you can edit the input line with ). If you run it from a terminal window, you can press any key and immediately get the result (for some keys, you'll get more than one number) and there is no echo of your input and no editing.