2

Possible Duplicate:
C/C++: Capture characters from standard input without waiting for enter to be pressed

Is there a way to read standard input continuously? I want to make an X and O game and I want the player to use the the arrows to move its position on the grid. I can't use cin because it requests you to press enter to get the input data into variables. So, does a function or an object doing that exist?

Community
  • 1
  • 1
user1215706
  • 105
  • 2
  • 5
  • 2
    There's no platform-independent method. – n. m. could be an AI Feb 17 '12 at 08:10
  • 1
    This explains how to do it in a console application for both Windows and Linux: http://stackoverflow.com/questions/421860/c-c-capture-characters-from-standard-input-without-waiting-for-enter-to-be-pr – termie Feb 17 '12 at 08:19

1 Answers1

3

For console (text) applications you'd use something like ncurses, which does terminal 'GUI' controls.

For graphics applications you would use something like SDL which enables event-driven programming.

sehe
  • 374,641
  • 47
  • 450
  • 633