how to shut down keyboard input buffer to directly react my key strike

I am trying to write a game which need to control the action.
It is obviously bad to press enter key each time.

Because game needs infinit loop, so the waiting me press enter key each loop would stop the loop.
I need a way to check if there is input, a way to sidestep the cin buffer, which requires me strike enter key, a way to shut down the input and reopen the input.

would anyone be kind to show me the way.
Thanks so much!
You should not use cin then.
If you are on linux, use NCurses
If you are on Windows and do not use any libraries use WinAPI function GetAsyncKeyState or install hook to catch events: http://stackoverflow.com/questions/2067893/c-console-keyboard-events

Also you can use kbhit() function from <conio.h> header.
thanks.
Topic archived. No new replies allowed.