Home c++ Event processing on keystrokes in C++ console

Event processing on keystrokes in C++ console




I do not understand how to make event processing when you press the button in the C++ console.
Moreover, that this button on the keyboard is exactly the one that I will indicate, that is, not just pressing any key, but defined. Thanks in advance.

Answer 1

# include & lt; conio.h & gt;
// ...
Char C = _Getch ();
if (C == 'W') {
   // The 'W' key was pressed

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions