Thread: Intercept Keystroke

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    17

    Intercept Keystroke

    I am writing a small konsole game ( tic tac toe, what else ) and want to get a number from the user. Now i dont want that the user has to hit enter. I hope that is enough that too understand me.

  2. #2
    Master of the Universe! velius's Avatar
    Join Date
    Sep 2003
    Posts
    219
    With using Microsoft's Visual C++ IDE it has a function in conio.h
    Code:
    int _getche();
    That fuction will get the character without the need for the enter key. If you're using a different compiler you may have this function but in a different header file.
    While you're breakin' down my back n'
    I been rackin' out my brain
    It don't matter how we make it
    'Cause it always ends the same
    You can push it for more mileage
    But your flaps r' wearin' thin
    And I could sleep on it 'til mornin'
    But this nightmare never ends
    Don't forget to call my lawyers
    With ridiculous demands
    An you can take the pity so far
    But it's more than I can stand
    'Cause this couchtrip's gettin' older
    Tell me how long has it been
    'Cause 5 years is forever
    An you haven't grown up yet
    -- You Could Be Mine - Guns N' Roses

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help passing keystroke to program
    By snap-tech in forum C++ Programming
    Replies: 2
    Last Post: 02-01-2008, 04:41 AM
  2. Problem with keystroke stacking
    By Flakster in forum C++ Programming
    Replies: 13
    Last Post: 10-20-2005, 02:18 PM
  3. Intercept Close Message?
    By OneMan in forum Windows Programming
    Replies: 10
    Last Post: 07-29-2004, 03:39 AM
  4. keystroke processing
    By lambs4 in forum Windows Programming
    Replies: 3
    Last Post: 09-07-2003, 04:22 PM
  5. how to intercept / prevent file creation?
    By xeno in forum Windows Programming
    Replies: 6
    Last Post: 05-06-2003, 02:33 PM