Hi,
I am using the following code to read in characters from the command line:
InputStreamReader isr = new InputStreamReader(System.in);
char in = 'a';
while(true)
{
in = (char)isr.read();
//do stuff here
}
The problem with this is, the user needs to press the enter key every time they enter a character. I need the program to read the character the instant that they have pressed it, and it must not require the user to press the enter key.
I have toyed with various methods of reading from System.in, such as BufferedReaders, and reading straight from the InputStream with no luck. Could anyone give me advice on how to go about this?
Thanks,
x0psci