A
Alvaro Puente
Hi all!
I'm writing a program in which I want to stop execution until user press
Enter.
The program works fine if user press Enter only once but, if pressed more
than once,
the next time the program asks for user input, the execution does not stop.
I guess it is because there are a few entries in the System.in buffer, so
program does
not block waiting for user entry since there are entries already in the
buffer.
I'd like to delete all those entries before doing readLine(), which will
block until
user press enter.
Do you know how can I empty System.in buffer?
Thanks a lot/Alvaro
I'm writing a program in which I want to stop execution until user press
Enter.
The program works fine if user press Enter only once but, if pressed more
than once,
the next time the program asks for user input, the execution does not stop.
I guess it is because there are a few entries in the System.in buffer, so
program does
not block waiting for user entry since there are entries already in the
buffer.
I'd like to delete all those entries before doing readLine(), which will
block until
user press enter.
Do you know how can I empty System.in buffer?
Thanks a lot/Alvaro