[Top][All Lists]

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

Re: Problem with keys

From: Mike Gran
Subject: Re: Problem with keys
Date: Fri, 2 May 2008 07:46:46 -0700 (PDT)

I'm sure Dickey knows better, but, I can give a stab at answering your

> From: galapogos 
> I'm using KEY_BACKSPACE to detect for backspace. It's ASCII value seems to
> be 263, but when I test my app using Mandriva (Konsole), backspace seems to
> be ASCII value 127 instead, so the backspace is never detected. Why is there
> a discrepancy between the 2?

ASCII 127 is the DELETE key.  Either KDE or Konsole must have set an option to 

> Also, I've tested the app on another self compiled Linux kernel(
> with busybox. In this environment, backspace is ASCII value 263, so
> KEY_BACKSPACE works. However, the "Break" key, as well as Alt-Break,
> Shift-Break, Ctrl-Break, seems to convert to 2 ASCII characters -  "[P".
> This doesn't happen in Mandriva. What's wrong here? Why is break an ASCII
> character when it's clearly not?
It probably isn't just "[P".  It probably is something like ESC [P.  Special 
keys like BREAK are sent through the terminal as a group of three or four ascii 
characters like "ESC [P", and then getch converts those characters back into a 
or whatever.  But for getch to work properly, you need to have set an 
environment variable called TERM correctly.  This somehow allows getch to find 
appropriate conversion table in the terminal database (termcap/terminfo).  

If it can't find a special key sequence like ESC [P in the database, it just 
sends the raw ASCII keys through.

Hope this helps.
Mike Gran

reply via email to

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