Calling a function with delay
Hi all,
I have a function void CMaskCntl::getloc() which gets the location coordinates.
I want to call this function again and again after a certain delay, say 5 sec..
How should I do this?
Regards
Amit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#include <iostream>
#include <ctime>
void doSomething();
int main()
{
while(true)
{
doSomething();
clock_t timer = clock();
while(((clock() - timer) / CLOCKS_PER_SEC) <= 5)
{
//do nothing
}
}
return 0;
}
void doSomething()
{
std::cout << "Did Something!\n";
}
|
Topic archived. No new replies allowed.