Reputation: 2239
How do I get the key codes so I can process arrow, pageUp, pageDown, etc, keys using simple C or C++?
I can get the regular keys, I do not know how to get these special keys.
Upvotes: 0
Views: 2096
Reputation: 622
Linux based systems follow the UNIX tradition, in the sense that those keys are special and their values depend on the terminal settings.
This is so, because in the old days each UNIX system had a complete different type of keyboard. As such it is somehow complex to be able to write generic code to handle those special keys.
The best way is to make use of a terminal handling library, like curses or its successor ncurses.
Here you can get a nice introduction about keyboard usage,
http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/keys.html
Upvotes: 0
Reputation: 540
Ncurses should be able to handle that. There is lots of tutorials out there
Upvotes: 2