Skip to main content
gamedev.net
🔒 Locked

while (!_kbhit() );

Started by Deifante Aug 30, 2000 at 10:42 PM 1 replies 850+ views
Original Post
Deifante
Deifante
Hello I''m pretty new to programming and I have a program wherein I use the while (!_kbhit() ); string of code several times. The problem is that it only works sometimes. I''ve tried cout<C++ 6.0
Look!... my comments line up!
Ironblayde
Ironblayde
I''d have to agree with my esteemed colleague Dr. Nes on the "Evil! Evil!!!" part... but really, the reason it''s not working all the time might be that you''re hitting a key that has an extended (2-byte) ASCII code. For instance, if you press an arrow key, PgUp, PgDown, etc., two characters are sent to the keyboard buffer instead of just one: a null character, followed by an identifying character. It could be that when you press such a key, it triggers two of your kbhit statements, one for the null, and one for the second byte. Just a guess, though, since I never use that evil stuff myself.

-Ironblayde
 Aeon Software
"Your superior intellect is no match for our puny weapons!"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.