Thread: How to put a Char into the Input buffer of a console?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    If all you want to do is monitor for escape then try something like:
    Code:
    DO
       use non-standard getch() for next user keystroke
       IF keystroke is ESC
          return
       ENDIF
       put keystroke back to console, ungetch(), so cin can read it later
    WHILE user has not hit ENTER
    cin.getline()
    [EDIT]
    This don't work - read below...

    gg
    Last edited by Codeplug; 03-09-2003 at 09:31 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  2. writing a pack-style function, any advices?
    By isaac_s in forum C Programming
    Replies: 10
    Last Post: 07-08-2006, 08:09 PM
  3. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  4. Writing past ...
    By Ana Val sazi in forum C++ Programming
    Replies: 8
    Last Post: 06-29-2002, 08:43 AM
  5. getline problem
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 10-06-2001, 09:28 AM