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
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.
Re: how to write this c program
Quote:
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