Hello, I'm looking for an easy way to wait for a keypress in a non-gui application.

Example: I press A, program says "You pressed A"

I AM NOT LOOKING FOR STRINGS AND ENTER! THIS NEEDS TO WORK FOR THE ARROW KEYS!

You can use some windows functions with command prompt. It will not be GUI but still windows.

Normally you would put the input device (stdin for C or cin for C++), and preferably use the POSIX termios functions to set the device into raw (unbuffered, unmapped) mode. That would normally be the tcsetattr() function. On Windows, if you don't have the POSIX libraries and headers installed, there are similar, but different functions to put the standard input port into raw mode so you can get the actual data generated by a keystroke.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.