Question

I want to call Sleep(x), where x is milliseconds to sleep. I know this is the function, but it doesn't work for me. What do I need to include?

---SOLVED---

I was using the compiler option /Za, which disabled the native Windows extensions used in Sleep()'s implementation.

Was it helpful?

Solution

Sleep is defined in Winbase.h, but you should include Windows.h to get it.

In the future you can find your information for yourself by bringing up the Help from VisualStudio or searching MSDN. All such info on Win32 API calls should be in there.

OTHER TIPS

Sleep Using WINAPI Sleep(__in DWORD dwAtleastFor8HoursForGoodHealth);

Include Winbase.h or Windows.h

you just Sleep(asManyMilliSecondsAsYouWant);

Sleep(int milliseconds) is a Win32 API to suspend execution of your program for the set number of milliseconds.

Include <windows.h> to get access to it.

MSDN usually lists what header files and libraries API's are in.

This might be a bit too late (for the 'asker' :)), but in MSVC (2010) (console application) the sleep is in SECONDS not Milliseconds.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top