comp.lang.ada
 help / color / mirror / Atom feed
From: f.tolkamp@chello.nl
Subject: Re: How to get a key from keyboard
Date: Mon, 22 Dec 2008 08:22:51 -0800 (PST)
Date: 2008-12-22T08:22:51-08:00	[thread overview]
Message-ID: <a900a094-8847-43e2-a081-dda6166cae37@k36g2000pri.googlegroups.com> (raw)
In-Reply-To: f1c4d01c-b9ea-4149-98b4-7a37a72e25d6@20g2000yqt.googlegroups.com

On 1 dec, 08:28, christoph.gr...@eurocopter.com wrote:
> 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 <enter> - 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 <backspace>). 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.

Indeed I run the program within GPS, so the enter key have to be
pressed. How can I run the program from a terminal window?



  reply	other threads:[~2008-12-22 16:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-28 15:20 How to get a key from keyboard tolkamp
2008-11-28 15:47 ` Gautier
2008-11-29  6:15   ` Paul
2008-12-01  7:28     ` christoph.grein
2008-12-22 16:22       ` f.tolkamp [this message]
2008-12-22 17:40         ` Georg Bauhaus
replies disabled

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