Sign in to follow this  
APC

Sleep() function?

Recommended Posts

APC    133
I'm trying to use the Sleep() function in c++, but can't seem to find the correct header file. Anybody know what its called? Thanks ahead of time

Share this post


Link to post
Share on other sites
Fruny    1658
sleep() is in <unistd.h>, but might also be found in <cstdlib>, possibly renamed _sleep() on Win32 platforms.

Sleep() is likely to be in <windows.h>

Share this post


Link to post
Share on other sites
dave    2187
Has extra functionality been added to cstdlib over stdlib.h. I looked in K & R and there was no mention of the sleep function being in stdlib.h.

Dave

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Actually, Sleep is declared in the WinBase header, though you should include the Windows header.

Share this post


Link to post
Share on other sites
Fruny    1658
Quote:
Original post by Dave
I looked in K & R and there was no mention of the sleep function being in stdlib.h.


AFAIK, sleep() is POSIX, though not ISO. Its proper resting place is unistd.h, but Windows platform, although they claim some level of POSIX compliance, do not have that header.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this