I want a function to be executed in a while-loop with intervals of x seconds.
Here's what I've got:
No error, but it's not working! I tried a lot of things and I've read http://faq.cprogramming.com/cgi-bin/...&id=1043284392Code:while (1)
{
if (loopcount == 0)
{
function();
loopcount++;
}
if (loopcount == 1)
{
int milliseconds = 3000;
long timeout = clock() + milliseconds;
if(clock() < timeout)
{
// nothing
}
else
{
loopcount--;
}
}
}