Hi. I'm kind of new to C++ and I was wondering if it's possible to make a program pause until a certain key is pressed. (I don't mean any key, I mean a certain key.
Also, is it possible to set a parameter's value to the key pressed?
I use Windows XP and my compiler is Visual C++ 2010 professional.
I'm surprised nobody answered you coding4fun. That's easy to do. When a key is pressed, a key code is generated by the keyboard driver. There are ways to obtain this key code using the C Standard Library functions, the C++ Standard Library functions, and the Windows Api. For example, the Asci code (decimal) of the numeric zero key is 48. I havn't played with this stuff in awhile, but was quickly able to dig this up for you. There are many other ways to do it...
Compile and run the program as a console program. Any key you hit will show up in the display. You can end the program by hitting the [ENTER] key (13) or the [ESCAPE] key (27). Hope this helps!
Here's an even better one for you. It not only shows keys pressed, but mouse movements too!. It is fairly advanced though, and uses the kernel functions in the Windows Api. Hit [ESCAPE] to exit.