Hello everyone. Is there a time delay function defined in ANSI/ISO C++, perhaps similar to sleep() or delay() of Borland C++?
Hello everyone. Is there a time delay function defined in ANSI/ISO C++, perhaps similar to sleep() or delay() of Borland C++?
>>Is there a time delay function defined in ANSI/ISO C++
Nope, you have to roll your own or use a nonstandard function offered by your compiler :-)
*Cela*
See my posts at:
http://www.cprogramming.com/cboard/s...threadid=34029
Code:void mySleep(float seconds) { using namespace std; clock_t goal_time = clock() + static_cast<clock_t>(seconds*static_cast<float>(CLOCKS_PER_SEC)); while (clock() < goal_time); }
Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling
Thanks Sang-drax, that did the trick. I will try to figure out how exactly the code works soon enough.