cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Kbhit
Kbhit
Jul 22, 2012 at 2:34am UTC
coderire
(10)
hi i want to write infinite loop which only terminates if the Ctrl-c is pressed from the keyboard.How do i use kbhit to do this?
Jul 22, 2012 at 4:54am UTC
soranz
(536)
Doesn't the console do that anyway on Ctrl-c ?
kbhit will only tell u if a key was hit. u'll need to call something like getch() to figure out what the key was immediately after kbhit returns nonzero
Jul 22, 2012 at 7:23am UTC
kbw
(9488)
You should use signal() to catch Ctrl-c and Break.
Jul 22, 2012 at 9:55am UTC
viliml
(791)
use getch, and check if the result is the number 3
Topic archived. No new replies allowed.