Date: Fri, 27 Feb 2015 15:20:14 +0100 From: Matthias Apitz <guru@unixarea.de> To: freebsd-java@freebsd.org Subject: read unbuffered from STDIN Message-ID: <20150227142014.GA4468@c720-r276659>
next in thread | raw e-mail | index | archive | help
Hello, I wnat to read chars from STDIN console as they are typed in and without waiting for \n. I tried with no luck somethink like this: //Use a BufferedReader to read characters from the console. import java.io.*; class reader { public static void main(String args[]) throws IOException { char c; System.out.println("Enter characters, 'q' to quit."); // read characters do { c = (char) System.in.read(); System.out.println(c); } while (c != 'q'); } } This does not work in FreeBSD+eclipse and as well not when started as $ javac reader.java $ java -cp . reader Any ideas? Thx matthias -- Matthias Apitz, guru@unixarea.de, http://www.unixarea.de/ +49-170-4527211 La referencia de la Duma a la anexión de la RDA, en este caso al contrario con la CrimlÃa sin referéndum, no solamente tiene gracia sino da en el blanco.- Marinos Yannikos @MarinosYannikos en un blog de RTdeutsch.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150227142014.GA4468>