Hello All.
I am working on a simple console app to get my feet wet with curses again. I am having a bit of a problem porting my app from xp to AIX. Here is a sample chunk of code.
int main(void)
{
WINDOW *_window = initscr();
int _rows;
int _cols;
cbreak();
/* Accept all keys */
keypad(_window, true);
/* Don't echo things that are typed */
noecho();
/* Get the screen dimensions */
getmaxyx(_window, _rows, _cols);
/* Don't display cursor */
curs_set(0);
for (;;)
{
printw("Press a Key ");
refresh();
int key = wgetch(_window);
printw("%d \n", key);
}
endwin();
return 0;
}
When I run this under XP, I get the following output from a DOWNARROW followed by a CTRL-DOWNARROW.
Press a Key 258
Press a Key 481
Press a Key
Suggesting 258 is the code for the down arrow, and 481 for ctrl-down arrow.
Performing this same test under AIX.
Press a Key 1858
Press a Key 27
Press a Key 79
Press a Key 66
Press a Key
The 1858 is the down arrow, and the 27/29/66 is the response for the ctrl-down arrow. I recognize that the 27/29/66 is probably one of the standard escape sequences. I was hoping that curses would map it to a single value. The XP side has a CTL_DOWN defined in the curses.h file. The AIX side does not.
So my question here is
Is them some incantation I missed here, that will magically map those three character into a nice unique integer? or do I have to write a class of some sort, to handle hiding the platform specific keystrokes into something my real app can use?
My eyes are blood shot from searching the AIX online stuff. Any help to point me in the correct direction would be appreciated.
Other random information
I am running xp pro, with the latest service packs msvc 6, with service pack 6. The curses library is pdcurses
The other compiler is IBM XL C/C++ ENTERPRISE EDITION V8.0 The compile uses
xlc++ -g app.cpp -lcurses
I am using pdcurses33 on the pc and the native curses on AIX.