What is the keycode of "Escape" while using curses.h????
is it KEY_EXIT?? I hv used this bellow but when i press escape, it prints "^[" instead of stopping the loop! and when i press "g", it does what i want the code to do when "escape" is pressed!!...Help! I am using "CodeBlocks 8.02" in Windows XP.
#include<stdio.h>
#include<curses.h>
int main()
{
char c;
int x=0,y=0;
initscr();
keypad(stdscr,TRUE);
noecho();
loop:
c=getch();
switch(c)
{
case KEY_RIGHT:
{
x++;
move(y,x);
goto loop;
}
case KEY_LEFT:
{
x--;
move(y,x);
goto loop;
}
case KEY_UP:
{
y--;
move(y,x);
goto loop;
}
case KEY_DOWN:
{
y++;
move(y,x);
goto loop;
}
case KEY_EXIT:
{
printf("Bye");
break;
}
default:
{
printw("%c",c);
goto loop;
}
}
endwin();
return 0;
}