If your working with a Windows console this might be of some use. In combination with Virtual-Key Codes I think you could figure it out.
Regards,
Brian
Code:
#include <windows.h>
#include <iostream>
#include <cstdlib>
using namespace std;
WORD scanKeyboard(void)
{
DWORD dwCharsRead;
INPUT_RECORD inRec;
HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE);
while(ReadConsoleInput(hInput, &inRec, 1, &dwCharsRead))
if(inRec.EventType == KEY_EVENT && inRec.Event.KeyEvent.bKeyDown)
return(inRec.Event.KeyEvent.wVirtualKeyCode);
return('ì'); // dummy return to suppress warning msg.
}
int main( int argc, char * argv[] )
{
WORD c;
do
{
cout << "\nEnter something, N to exit: ";
c = scanKeyboard( );
cout << c;
if(c == VK_UP)
cout << " : Up Arrow key pressed";
}while(c !='N');
return(0);
}