lamas
lamas

Reputation: 4598

C++ key input in Windows console

I'm currently developing various console games in Windows that won't really work using regular input via cin.

How can I (In a simple way using only standard windows libraries available in MSVC):

It would really help if you could include a short example program for your solution

Upvotes: 5

Views: 13253

Answers (3)

jacopo
jacopo

Reputation: 21

I've got just what you need.

Here enjoy pal: C++ source

It's pretty much self-explanatory but if you have any doubts my email is [email protected]

Upvotes: 2

anon
anon

Reputation:

You want the Windows Console API, for example PeekConsoleInput.

Upvotes: 1

Goz
Goz

Reputation: 62323

AFAIK you can't do it using the standard C runtime. You will need to use something such as the Win32 function GetAsyncKeyState.

Upvotes: 1

Related Questions