Thread: Getting KeyPress

  1. #1
    Information Crocodile
    Join Date
    Dec 2004
    Posts
    204

    Getting KeyPress

    Is there a c function that automatically detects a keypress.. that at once i can print it using outextxy() function once the key is pressed?

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    what is outextxy() ?
    The function getch() from conio.h will work but you compiler may not have it because it is not standard and not recommended. AFAIK there is no standard way to receive a kepress without hitting enter.

    (I think I may have misunderstood the question)

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    What compiler are you using?
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Information Crocodile
    Join Date
    Dec 2004
    Posts
    204
    Quote Originally Posted by sand_man
    what is outextxy() ?
    The function getch() from conio.h will work but you compiler may not have it because it is not standard and not recommended. AFAIK there is no standard way to receive a kepress without hitting enter.

    (I think I may have misunderstood the question)
    I mean once my program detects a keypress i want to automatically print it using outtextxy and not press enter before i can print it..

  6. #6
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Try the links that Hammer posted.

    And tell us what compiler you're using.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. (MFC, Visual C++) Keypress Detection in a dialog...
    By guitarist809 in forum Windows Programming
    Replies: 4
    Last Post: 08-31-2008, 01:13 PM
  2. Detecting keypress
    By dandago in forum C Programming
    Replies: 4
    Last Post: 06-10-2007, 09:34 AM
  3. How do I NOT wait for a keypress?
    By misplaced in forum C++ Programming
    Replies: 9
    Last Post: 04-13-2005, 04:10 PM
  4. Getting input without waiting for keypress
    By Ink in forum C Programming
    Replies: 4
    Last Post: 10-01-2004, 01:38 AM
  5. detecting keypress
    By lithium in forum C++ Programming
    Replies: 3
    Last Post: 02-16-2003, 01:10 AM