Re: [JAVA] Unbuffered access to stdin

From: Gordon Beaton (not_at_for.email)
Date: 03/05/05


Date: 5 Mar 2005 20:38:01 +0100

On Sat, 05 Mar 2005 21:05:44 +0200, Max wrote:
> I am writing an interpreter for an esoteric language (in the vein of
> BrainF***). The only input instruction is read-byte-to-stack.

I'll interpret that to mean that you want to be able to read from
System.in without waiting for the user to press enter - is that right?
If so, it's your OS console, not Java's buffering of System.in that
prevents it, and consequently unbuffering System.in (alone) won't let
you do it.

You *can* read individual bytes from System.in without waiting for
enter. Try piping input from a file or other source to see that it's
possible.

On unix-like platforms, you can use "stty -icanon min 1" to change
console mode so you can do character-at-a-time input. On other
operating systems, I have no idea.

/gordon

-- 
[  do not email me copies of your followups  ]
g o r d o n + n e w s @  b a l d e r 1 3 . s e


Relevant Pages

  • Re: TCL/TK , Java
    ... >shift the time from waiting for the compiler to waiting for the GUI ... Tcl/Java, just for the interpreter and its associated shell, ...
    (comp.lang.java.gui)
  • Re: TCL/TK , Java
    ... >shift the time from waiting for the compiler to waiting for the GUI ... Tcl/Java, just for the interpreter and its associated shell, ...
    (comp.lang.tcl)