It is best to create a custom GetAsyncKeyState function that will use #IFDEF for Windows and Linux to select the appropriate GetAsyncKeyState () or equivalent.
There is no other way to achieve the desired result, the cin approach has its own problems - for example, the application should be in focus.
user2180519
source share