Image

Imageskreyola wrote in Imagecpp 😟distressed

Waiting without spinning?

HI, all.
Some time back, I faced a programming difficulty in that I wanted to grab one character from the keyboard without waiting for a CR. At the time, I was on a Wintel, and didn't have ncurses, which was the suggested answer for portable key-at-a-time input.
I'm now on a Linux box and have access to ncurses, but getch() doesn't seem to wait for anything; the program just flies past it. Is there any way to make getch() sit and wait, or if not, how do I make my program pause a quarter second or so between checks for user input, so that my program won't spin and use up all the CPU cycles?