How can I make it so if the user hits the arrow key that the program will see it as input in a console application? I am using the Dev C++ compiler.

Recommended Answers

All 3 Replies

I think you'll probably have to check out the Windows API (if you are using Windows) for that. Check out there's a lot of good information on there assuming you can find what you are looking for.

If you are on UNIX/Linux you can get that from the X11 libraries. I can't remember exactly what the code looks like, but X11 will poll the keyboard and return an event anytime a key is pressed. There are some resources out on the web for more info.

Hope that helps.

download this brief example program. and look at tic2a.c. It uses non-standard functions but might work with your compiler if you include conio.h.

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.