|
-
February 5th, 2007, 11:43 PM
#1
how to write this c program
hi,
i need to write a "c" program that
when i press a key on keyboard of PC, it should reply in the output
saying that "key is pressed"
and if the key is hold for more than 350ms it should reply that
"the key is hold"
can u help me by giving some tips for this program
-
February 6th, 2007, 04:11 PM
#2
Re: how to write this c program
If you are restricted to the C language, then the first part can be done with simple C input / output using functions such as printf(...) and scanf(...) defined in the header <stdio.h>.
For the second part with the exact timing of 350ms, there is no real language support for these kinds of measurements. In addition, the keyboard itself has hardware settings for the repeat function. This all makes this kind of stuff a bit tricky. Can you further explain your target environment for the second part of the question?
Chris.
Last edited by dude_1967; February 6th, 2007 at 04:12 PM.
Reason: clarity
You're gonna go blind staring into that box all day.
-
February 6th, 2007, 11:12 PM
#3
Re: how to write this c program
 Originally Posted by srikanth123456
hi,
i need to write a "c" program that
when i press a key on keyboard of PC, it should reply in the output
saying that "key is pressed"
and if the key is hold for more than 350ms it should reply that
"the key is hold"
can u help me by giving some tips for this program
have a look in MSDN for getch() and kbhit()
Thanx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|