I've a problem with a console application and the Sleep() api call.
What I need/want, in some states of the program, is to release the timeslice
in a console application while it is waiting on (non blocking) user input.
For that I need access to usleep(msec) or Sleep(msec). A call to sleep(sec)
is not realy an option. Users will notice a delay of one second most
The alternative is to do busy-waiting and keep the processor load at 100%.
Not a nice option.
Another alternatice is to switch between blocking and non-blocking input
which doesn't sound atractive to me. (more code prone to buggy behaviour)
Since the application is a console application I can't include <windows.h>.
If I do, a load of compile errors is the result.
But to use sleep(), usleep() or Sleep() I must include <windows.h> according
to the documentation.
Does someone know how to call a windows API call from a console application?
Does someone have a suggestion to tackle this problem?
Andre S *** veld.