I knwo how to use gotoxy(x, y) but how do I detect an arrow key using console?
Printable View
I knwo how to use gotoxy(x, y) but how do I detect an arrow key using console?
Hopefully that will work, if not, reply. It works for me, I'm using DJGPP BTW.Code:#define leftarrow 'K'
#define uparrow 'H'
#define downarrow 'P'
#define rightarrow 'M'
getch();
if (getch()==leftarrow)
{
...
...
}
That didn't work. I am using Bloodshed Dev-C++ 4/4.01 compiler.
For the gotoxy() in a console;
FAQ - Various
For the <- and -> keys, I guess you would need to somehow read WM_KEYUP messages and respond to VK_LEFT and VK_RIGHT, but in a console this would not be easy........ If you want edited input in your program I guess you would be better off with an editbox in a Win32 Application.
Out of interest, what are you trying to do