Troubleshooting kbhit() and control-C for Keyboard Input in Programming

  • Thread starter Thread starter timetraveldude
  • Start date Start date
AI Thread Summary
The issue arises when a program that waits for keyboard input encounters a Control-C command to exit, resulting in an error. This error likely occurs because the program exits before executing the code associated with detecting keyboard input through kbhit(). To resolve this, it is suggested to capture the Control-C escape sequence and implement a manual exit process. Additionally, the use of kbhit() is noted as it is a non-ANSI standard function, which may also contribute to compatibility issues.
timetraveldude
Messages
42
Reaction score
0
I have a programming running that waits for keyboard input. The problem is that when I press control-C to exit the program I get an error. I believe it is because the keyboard was pressed but the program is exiting before it can execute the code that is called when kbhit() is true. Any ideas.<br />
<br />
thanks.
 
Computer science news on Phys.org
thanks

thanks for the help.
 
This week, I saw a documentary done by the French called Les sacrifiés de l'IA, which was presented by a Canadian show Enquête. If you understand French I recommend it. Very eye-opening. I found a similar documentary in English called The Human Cost of AI: Data workers in the Global South. There is also an interview with Milagros Miceli (appearing in both documentaries) on Youtube: I also found a powerpoint presentation by the economist Uma Rani (appearing in the French documentary), AI...
Back
Top