Results 1 to 9 of 9

Thread: True single input on command line

Threaded View

  1. #1

    Thread Starter
    Member daveyboy's Avatar
    Join Date
    Feb 2002
    Location
    Aberystwyth, UK
    Posts
    33

    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



    Infinity isn't large it's just incomprehensible
    Last edited by daveyboy; Mar 20th, 2002 at 01:33 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width