kbhit() for linux.

This is a discussion on kbhit() for linux. within the C Programming forums, part of the General Programming Boards category; I only want the program to quit if the user has hit a key and that key corresponds to the ...

Thantos' method will probably work a little bit better. There's a little bug in mine where if you press a key when the program isn't at the right point, the character will echo to the screen when it's not supposed to.

You're changing the mode back to 0 after the first call to kbhit(). Does that make any logical sense to you? Look how Thantos implemented it. Does he change the mode back to 0 inside the kbhit() loop? He doesn't. That should tell you something.