Timers related question

Hello everyone.

Quite straightforward: which function can I use to make a program count (in seconds, milliseconds or whatever) how much time a keyboard's key is pressed (to then store the data into a variable)? If no specific function exists, what structure can I use to accomplish it?

Best regards
I can answer your first question.

To make a program count in seconds or milliseconds you could use the Sleep(unsigned number); function, it takes a variable representing milliseconds, so Sleep(1000); would make the computer sleep for 1 second before returning operation to the user.

As for time a key is pressed down I am unsure, you may have to call upon the CTime header but don't quote me on it.

I hope that's of some use to you.
Thank you very much for trying, but I already knew of sleep function and I actually need to have the key_pressed_time on a variable, not output wise but input. Thank you again anyway, I'll stay tuned for more ideas.

Best regards
Topic archived. No new replies allowed.