954,504 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Keystroke scanning

i need a command in c++ to scan the first keystroke the user enters ....(i.e) user doesnt have to press key...i need to scan as soon as he types....please help...thanks in advance....

IndianaRonaldo
Light Poster
39 posts since Jan 2011
Reputation Points: 7
Solved Threads: 1
 

This is dependent on your operating system.

http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.17

If you're using some kind of *nix and have termios.h available,

http://www.doctort.org/adam/nerd-notes/reading-single-keystroke-on-linux.html

Otherwise, tell us your operating system and we'll point you the right way.

Moschops
Practically a Master Poster
620 posts since Sep 2008
Reputation Points: 258
Solved Threads: 117
 

This is dependent on your operating system.

http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.17

If you're using some kind of *nix and have termios.h available,

http://www.doctort.org/adam/nerd-notes/reading-single-keystroke-on-linux.html

Otherwise, tell us your operating system and we'll point you the right way.

win7 x64....n thnx fr d rply...

IndianaRonaldo
Light Poster
39 posts since Jan 2011
Reputation Points: 7
Solved Threads: 1
 

It also depends on the compiler, too. Most compilers can't do it.

In your case, I would guess it's VC++ something, so getch() would work.

WaltP
Posting Sage w/ dash of thyme
Moderator
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
 

It also depends on the compiler, too. Most compilers can't do it.

In your case, I would guess it's VC++ something, so getch() would work.


hey thnx a lot...getch() worked....:)...

IndianaRonaldo
Light Poster
39 posts since Jan 2011
Reputation Points: 7
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: