Dec 9, 2011 3:31 pm
Xdevel1999Is it possible to read DEL and BACKSPACE keys from standard in?
If I use:
System.in.read()
these keys are never returned.
Thanks.
Dec 9, 2011 4:19 pm
Lewxdevel1999 wrote:
> Is it possible to read DEL and BACKSPACE keys from standard in?
>
> If I use:
>
> System.in.read()
>
> these keys are never returned.
>
> If I use:
>
> System.in.read()
>
> these keys are never returned.
It is only possible to read what the OS puts into the input stream. What is
the behavior of stdin from the OS point of view?
On your platform and most that we know, the OS buffers input on that stream
until it receives an end-of-line. That line is passed entire to Java to wrap
as an 'InputStream' input. It follows trivially that the Java stream cannot
see the characters you describe unless you escape them.
Have you escaped them?
"Never" is a very strong word.
<http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#in>
public static final InputStream in
<http://docs.oracle.com/javase/7/docs/api/java/io/InputStream.html>
Lew
Dec 9, 2011 6:29 pm
Roedy GreenOn Fri, 9 Dec 2011 07:31:39 -0800 (PST), xdevel1999
<xdevel1999@gmail.com> wrote, quoted or indirectly quoted someone who
said :
>Is it possible to read DEL and BACKSPACE keys from standard in?
I don't think you see anything until the user hits enter.
If you want to see things in a keystroke by keystroke way you need
some sort of gui TextField or the like where you can intercept the
event for each keystroke.
The other way to do it is to use C.
Roedy Green Canadian Mind Products
http://mindprod.com
For me, the appeal of computer programming is that
even though I am quite a klutz,
I can still produce something, in a sense
perfect, because the computer gives me as many
chances as I please to get it right.
http://mindprod.com
For me, the appeal of computer programming is that
even though I am quite a klutz,
I can still produce something, in a sense
perfect, because the computer gives me as many
chances as I please to get it right.
Previous Thread: Silly simply question
Next Thread: (java.lang.Runtime()).exec(new String[]) ...
Related Forum Topics
- How to read back the lines printed out to the console?
- Back to .Net? lesser of two evils?
- How can I read from the entire standard input at once?
- Read java Annotation field values from class
- Read java Annotation field values from class
- I need to write Simple JAVA program to read and write from USB serialto use it with Arduino
- Socket problem: read & write to same socket