Immediate user input process (without pressing enter?)
Is there any way to process user input (in the command prompt) as soon as the user presses a key? For example, if I had a simple menu such as:
Select an option:
A - Addition
S - Subtraction
M - Multiplcation
And I wanted the program to proceed as soon as the user typed the 'a', 's', or 'm' character, rather than <character> [ENTER] ... is this possible?
Another application I was considering would be similar to the Game Of Life application, but be able to control one of the characters and move its position (using the arrow keys if possible, or just wasd). It would get repetitive to press enter to input every move. Is there any way to avoid that? Thanks.
EDIT: And while I'm on the subject, are the arrow keys recognized by the C language (if that makes sense)? Is there a way to check if the user presses an arrow key (or other keys: home, end, pg up, etc.)?
Thanks, Kevin! That definitely steered me in the right direction.
Forum Rules/Features
Welcome to the WiBit.net forums! Check out our terms and features:
Hot Topic(s)
Annoy your friends
Is this something you think someone else would enjoy? Is it not for you, but do you know someone who is down with this type of content? Well share away:
Tweet
The Blog
Don't Let XML Make You a Cheater
This blog is a reminder that cheating in software development can get you into big trouble. Sometimes developers get really really lazy, OR are pressured to write something using overly simplified data structures. Almost every time this happens you are bitten in the butt! Sometimes the problems show up immediately and other times it may take months or years (especially in integrated systems).
- 1 of 78
- ››





















There are several ways to capture this. One way is to scan for interrupts like we did in an old WiBit.Net tutorial (Keystroke Logger in C++)
http://www.youtube.com/watch?v=rn20tjb1RDc
http://thepiratebay.se/torrent/4123532/
That works, but is considered "old school." Try to run it as a thread and see if it works for you.
I have also used the Microsoft getch function, which if you Google you can find a bunch of articles about it.