taming the cursor

J

joe.user0

Hello,


I have a text application in C that works well on
quick machines. On old PCs, I have to press and
release the arrow keys slowly. If I push and keep
an arrow key down, the cursor goes wild and lands
somewhere without any understandable pattern.

I need an idea - or some code - for the following:

after executing a command, discard the same
command if it comes within x milliseconds.


Thanks.


Joe
 
A

Alexander Bartolich

I have a text application in C that works well on
quick machines. On old PCs, I have to press and
release the arrow keys slowly. If I push and keep
an arrow key down, the cursor goes wild and lands
somewhere without any understandable pattern.

This is platform specific and thus off-topic.
I need an idea - or some code - for the following:

after executing a command, discard the same
command if it comes within x milliseconds.

Well, on some systems you can detect the events key-press and
key-release independently. Triggering on release would be a
simple workaround.

Anyway, the only way to measure time with a resolution below
one second is clock().
 
K

Keith Thompson

Alexander Bartolich said:
Anyway, the only way to measure time with a resolution below
one second is clock().

Um, not really. clock() measures CPU time, not real time. The
resolution of the time() function is commonly 1 second, but the
standard doesn't guarantee this.

Practically speaking, the only way to measure time with a resolution
below one second is to use some system-specific extension.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top