Click here to Skip to main content
15,868,120 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to get the ascii value of delete key by user input or cin.

What I have tried:

I know the delete key has an ascii value of 127.
I can also get this by using:
static_cast<int>('/x7f') or some similar sequence, but i need to get it via user input. How can i do that?
Posted
Updated 20-Feb-18 19:57pm

1 solution

I remember we used to do something like following during college days as I no more use C++. Check if it helps-
C++
char c;
c=getch();
cout << "Code for key pressed" << c;


Hope, it helps :)
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900