Hi guys,

Could anyone show me the best way to run a function every 10 minutes for ever?

Thanks guys!

The "best" way is debatable -- here is one way.

#include <windows.h>
#include <stdio.h>

void say_hello()
{
   printf("Hello\n");
}

int main()
{
   for(;;)
   {
       say_hello();
       Sleep(1000*10);
   }
}

Just to clarify, Sleep() takes milliseconds as argument, so the number for 10 minutes would be 1000*60*10.

commented: correct :) +36
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.