How would you capture the time between key strokes?
Example code in C (for solaris) or Java would be great.
Example code in C (for solaris) or Java would be great.
code:<HR>Code:getc(); /* blocks until a key is pressed */ time1 = get_system_time(); getc(); /* blocks until a key is pressed */ time2 = get_system_time(); printf("The time between keypresses was %d\n", time2 - time1);
Originally posted by EgalitarianBovine:
that would be a way to do it, but unfortunately, most filestreams are 'cooked'. I.e., a string of text is not sent to the actual program by the system until you hit return.
but unfortunately, most filestreams are 'cooked'.
you can use this approach to find the time between any two keystrokes (in a cooked stream)code:<HR>Code:while( !kbhit() ); /* wait until something is in the buffer */ { command = getch(); /* get it */ }
In C++ and using streams, yes... but you can do it with standard C functions.