kbhit()

This is a discussion on kbhit() within the C Programming forums, part of the General Programming Boards category; How do I get kbhit() working on a Linux machine as I keep getting the following error: sh-2.04$ gcc kbhit.c ...

  1. #1
    McNab
    Guest

    kbhit()

    How do I get kbhit() working on a Linux machine as I keep getting the following error:

    sh-2.04$ gcc kbhit.c -o kb
    /tmp/cciSyEJg.o: In function `main':
    /tmp/cciSyEJg.o(.text+0x8): undefined reference to `kbhit'
    collect2: ld returned 1 exit status

    I need to program to continue execution after a keyboard stroke, is there another way of doing this?

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    kbhit is for DOS.

    I did a search on groups.google.com and found this (among others):

    http://groups.google.com/groups?q=kb...infn.it&rnum=5

    I've got no idea if it works, is good or bad, hope it helps though.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Im a Capricorn vsriharsha's Avatar
    Join Date
    Feb 2002
    Posts
    192

    Thumbs up

    Try using getch() instead...That should solve ur problem.

    -Harsha.
    Help everyone you can

  4. #4
    Used Registerer jdinger's Avatar
    Join Date
    Feb 2002
    Posts
    1,065
    getch() is not ANSI standard. He may not even have it.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    There is never going to be an ANSI standard for reading a single keystroke. They may be able to use a function in the curses libray. I haven't personally used it.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 11-30-2007, 09:46 AM
  2. kbhit() for enter key? not working
    By yahn in forum C++ Programming
    Replies: 4
    Last Post: 04-03-2006, 03:44 AM
  3. implicit declaration of int kbhit(...);
    By Blizzarddog in forum C++ Programming
    Replies: 14
    Last Post: 11-13-2003, 05:39 PM
  4. Pausing for input, with kbhit() still detecting keys
    By Da-Spit in forum C++ Programming
    Replies: 5
    Last Post: 05-23-2002, 06:04 AM
  5. need more help on kbhit()
    By lordvlaad() in forum C++ Programming
    Replies: 0
    Last Post: 04-20-2002, 03:07 AM

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