Console input

This is a discussion on Console input within the C++ Programming forums, part of the General Programming Boards category; A conditional I'm using to break out of a loop is as follows. Code: if(InRec.Event.KeyEvent.uChar.AsciiChar == 'x') { break; } ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    44

    Console input

    A conditional I'm using to break out of a loop is as follows.

    Code:
    if(InRec.Event.KeyEvent.uChar.AsciiChar == 'x')
    {
        break;
    }
    How would I change it to wait for non-ASCII keystrokes, like Esc?
    Check out all my dimensions:
    Height, width, and for a limited time only... Depth!
    -sb

  2. #2
    Disturbed Boy gustavosserra's Avatar
    Join Date
    Apr 2003
    Posts
    244
    To tell the truth, I made this a long time ago *sigh*. I do not remember well how, but if you want a pointer search for the inportb function.
    It accepts a integer , that is what you want to ¨listen¨ to.
    Nothing more to tell about me...
    Happy day =)

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    44
    Whoa. I'm not sure what you're talking about on that one. I'm pretty sure this method will handle it, I'm just not sure how to modify it to do so.
    Check out all my dimensions:
    Height, width, and for a limited time only... Depth!
    -sb

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Replace 'x' with 0x1b, the ASCII value of ESC.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    44
    Shweet. Thanks.

    P.S. I learned this method from your tutorial in the first place, so thanks again.
    Check out all my dimensions:
    Height, width, and for a limited time only... Depth!
    -sb

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fscanf in different functions for the same file
    By bchan90 in forum C Programming
    Replies: 5
    Last Post: 12-03-2008, 08:31 PM
  2. For loop problems, input please.
    By xIcyx in forum C Programming
    Replies: 2
    Last Post: 04-22-2007, 03:54 AM
  3. Console input
    By ozzy34 in forum C++ Programming
    Replies: 9
    Last Post: 05-14-2004, 12:05 PM
  4. How to put a Char into the Input buffer of a console?
    By Aidman in forum C++ Programming
    Replies: 10
    Last Post: 03-09-2003, 09:05 AM
  5. Need help with Console Keyboard Input
    By pawelx2 in forum Game Programming
    Replies: 5
    Last Post: 05-30-2002, 11:03 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21