A functions name into a string

closed account (DGvMDjzh)
I want to make a function that would act as a timer and call a specified function when the timer ends. It should go something like this.

Timer(MSG("hi"),2000);

void Timer(??????, int Time) {
int EndTimer = clock() + Time;
while (EndTimer > clock()) {}
// Some kind of way to call the function
}

Any ideas would be appreciated.
Last edited on
I haven't clicked hamsterman's link yet, you should if you haven't already, but I wanted to point out that your while loop will spike the CPU and the only thing it is doing is checking that condition much more often then needed.

What libs are you using? We might have a better solution in one of those for what you are trying to accomplish.
Topic archived. No new replies allowed.