How may I get my program to recognise the arrow keys? I can get ESC key recognised with 27, but there is no ascii number for the arrow keys as I am aware. But there's surely another way to do it.
How may I get my program to recognise the arrow keys? I can get ESC key recognised with 27, but there is no ascii number for the arrow keys as I am aware. But there's surely another way to do it.
Which OS and Compiler?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Windows ME -- bloodshed Dev c++
I think the arrow keys return a scan code. The scan code for the two most popular types of keyboards are:
up arrow: 75h or 48h
left arrow: 6Bh or 4Bh
down arrow: 72h or 50h
right arrow: 74h or 4Dh
- "Problem Solving C++, The Object of Programming" -Walter Savitch
- "Data Structures and Other Objects using C++" -Walter Savitch
- "Assembly Language for Intel-Based Computers" -Kip Irvine
- "Programming Windows, 5th edition" -Charles Petzold
- "Visual C++ MFC Programming by Example" -John E. Swanke
- "Network Programming Windows" -Jones/Ohlund
- "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
- "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel
Well this is what I do to find out ascii code of key I wanna know. I use debug window of borland c++ 4.0 with this:
Then i use the debug window and look at the value of key for the ascii number. Always worked so far for me so, for '0' it's 48 on my pc.Code:int key = getch();