True single input on command line
Can anyone actually tell me a real platform independent way of esentially do what QBasic would have been an inkey$ (oh for the days of QBasic), I just want to grab the next key pressed, or ideally whatever key is being pressed at this precise moment in time.......
Someone suggested this:
Code:
String tmp = "";
char C='\0';
try{
while ((C=(char) System.in.read()) !='\n')
{
if (C != '\r') tmp = tmp+C;
System.out.print('\r');
}
} catch(IOException err){}
And that this would use System.in.read() to input single characters until return ('\r' within unicode) is entered.........
but it doesn't
I tried to go through the java source within System, and the classes for in (can't remember the class now), etc, but to no avail...
Any suggestions?
Dave.
PS if it looks stupid it's opera playing me up
:) :( :o :D ;) :p :cool: :rolleyes: :mad: :eek: :confused:
Infinity isn't large it's just incomprehensible