I've been trying to solve this problem for a while now with no luck. I want to monitor an input buffer(cin) for a keypress. The catch is, I don't want it to hang if the buffer is empty. getch()
and peek()
won't work because one waits for a keypress and the other waits for the return key. Is there any way to check for a keypress, but move on if there was no keypress? I know there is a DOS interrupt available in assembly, but I don't know how to do it with C.
nanodano
0
Junior Poster in Training
Recommended Answers
Jump to PostIf you have getch, you might have kbhit. That would be the easiest solution.
All 4 Replies
Narue
5,707
Bad Cop
Team Colleague
nanodano
0
Junior Poster in Training
nanodano
0
Junior Poster in Training
cniggeler
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.