chris200x9
May 8th, 2009, 11:42 PM
I am starting to learn ncurses, I have written a simple program (modified from the tutorial here: http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/init.html)
#include <ncurses.h>
using namespace std;
int main()
{
int ch;
initscr(); /* Start curses mode */
keypad(stdscr, TRUE);
printw("hit enter"); /* Print Hello World */
/* Print it on to the real screen */
getch(); /* Wait for user input */
ch=wgetch(stdscr);
if (ch == KEY_ENTER)
{
mvprintw(10, 10, "you hit enter");
refresh();
}
endwin(); /* End curses mode */
return 0;
}
my question is why when I hit enter it does nothing, instead of printing you pressed enter at (10,10). I am confused as why this is happening it seems simple enough, any help would be greatly appriciated! :P
#include <ncurses.h>
using namespace std;
int main()
{
int ch;
initscr(); /* Start curses mode */
keypad(stdscr, TRUE);
printw("hit enter"); /* Print Hello World */
/* Print it on to the real screen */
getch(); /* Wait for user input */
ch=wgetch(stdscr);
if (ch == KEY_ENTER)
{
mvprintw(10, 10, "you hit enter");
refresh();
}
endwin(); /* End curses mode */
return 0;
}
my question is why when I hit enter it does nothing, instead of printing you pressed enter at (10,10). I am confused as why this is happening it seems simple enough, any help would be greatly appriciated! :P