Friday, October 15, 2010

M$ "Sleep" function for C/C++

There is no "sleep" function in C, but (apparently similarly to one provided in unix) there is one that's part of the Windows libraries. If the correct .h file is included, it does sleeps in milliseconds. It's apparently not very precise, and must be capitalized, i.e. "Sleep(i)" where i is in milliseconds. Apparently, this is all very well known, but also still one of the most asked questions on forums. See the followoing links, all filled with entertaining flail:

http://cboard.cprogramming.com/c-programming/111229-how-use-sleep-function.html

http://forums.devshed.com/c-programming-42/using-visual-studio-2005-and-the-sleep-function-418938.html

http://stackoverflow.com/questions/3379139/sleep-function-in-windows-using-c