Mail Archives: djgpp/2000/03/22/16:50:50
wroot AT my-deja DOT com wrote:
> How can I read one keystroke from the keyboard (including but
> not limited to arrow movements, PgUp, PgDn, Del)? I've heard
> it is done with ncurses/curses. If someone could tell me
> which function, header file and namespace I should use, I would
> appreciate it.
'Curses' is a library, originally invented for Unix boxes where it's
meant to handle 'terminals' (those things with a keyboard, a screen, a
serial line, and just about nothing else...), cleverly. It's about
the most portable of all the unportable solutions to the 'getc without
having to type <Return>' FAQ in the C newsgroups.
'Ncurses' is a new version of it for Unix. On DJGPP, you have
'PDCurses' instead (pdcur24b.zip, in the 'v2tk' directory of the ftp
servers).
The function call is 'getch()', IIRC, the header is <curses.h>. No
namespace or so, as this is a C library, not a C++ one. Be prepared
for having to add a few 'extern "C"'s to your code.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -