[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble reading out some keys

From: Mike Gran
Subject: Re: Trouble reading out some keys
Date: Wed, 25 Feb 2009 07:08:19 -0800 (PST)

> Hi,
> I have problems with reading out some keys with getch():
> - Backspace (The key with which I delete the previous character) does not
> - Same with Enter/Rerurn and KEY_ENTER.
> - I can not find the key defintion for TAB and ESCAPE.

Check the ASCII table. ("man ascii" or google)

Some terminals will return the ASCII carriage return character instead of
KEY_ENTER.  Carriage return is "CR" in the ASCII table.  getch() will return 
13 for carriage return.

TAB is also an ASCII character.  TAB is "HT" or horizontal tab in the ASCII 
getch will return 9 for TAB.

ESCAPE is also an ASCII character. getch will return 27 for ESC.

Some terminals will map the backspace key to be the same as the delete 
key.  Depending on which terminal your are running, the delete key may 
return KEY_DC when the keypad is true or it may return 127, which is 
the ASCII delete character.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]