-
program delay (sleep)
hey every1, a quick question:
i would like my program to sleep for a indicated period of time.
I am using : sleep(2000);
I have been told that this should compile and the 2000 is in milliseconds. Is this correct or do i need to include a certain file as it is not compiling, also is it correct that the specified time is in milliseconds?
thanks alot for ur time
rxg00u
-
change to question
i have found out that the sleep fucntion is in the windows.h libary. Is there an equivalent to this that can be used with unix
thanks alot:D
-
I think unix may have a function called delay().
delay(num_of_sec);
-
According to this thread, there is a sleep() on POSIX systems.
http://www.cprogramming.com/cboard/s...ighlight=sleep
-
In <windows> it is Sleep(milliseconds) // note the capital 'S'
in dos.h for Borland Turbo CLC it is sleep(seconds), but the compiler gives you a warning message that the sleep function is obsolete. (It isn't supported in MSVC++... but since I use borland, I still use it from time to time)
-
If you have a delay/sleep executable in unix (you will have to look around a bit) you can run it from within your executable to provide a pause.
I remember there being one, but since I am on a win box right now, I cannot tell you what the binary name is...