This wastes CPU cycles for no good reason, sleep() and Sleep() exist for a reason
Stop trying Sleep(milliseconds) suggestions, its for Windows. You want sleep(seconds). But then again, Why do you want to 'sleep' in the first place?
Printable View
Sorry to jump in, but I'm programming on RedHat Linux and need a sleep function...any ideas what header I would need to include?
hi,
I saw all the confusion about sleep and Sleep.
Let me clarify, Sleep is a windows function which makes your process wait for a number of "milliseconds" you specify as an argument to it. For using Sleep on windows you need to include windows.h
However, on Unix/Linux the function is sleep() and it makes your process wait for the number of "seconds" you specify as an argument to it.
For using it you need to include the header file unistd.h on Unix/Linux.
sleep() actually makes the current running process wait for the number of seconds you specify.
I dont really see a reason why your code doesn't wait before the popen.
If you could put some more of your code, it would be easier for me to know.