문제

I am trying to use keystrokes to affect my program. For example, I have a program that prints numbers continuously. I want it to stop printing numbers if I enter Ctrl+E. How can I do this on C++?

I have read about a number of headers like conio.h but they are not built in the C library. I would like this to be kept as pure C/C++ as possible.

올바른 솔루션이 없습니다

다른 팁

you can use GetAsyncKeyState function for this.

It is there in Winuser.h file

That depends on the operating system - hence impossible in 'pure' C/C++. I fear you have to go with #ifdef SYSTEM_A, ... Please notice, The languages C/C++ are not aware of any kind of hardware (keyboard in this case), they know streams.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top