Is it possible to get the local time of a machine ( i can do this part ) then generate a random number between 1-5 ( i can do this ) then add the two together then execute a file when that time comes.

Like:

Local Time: 10:05
Random Number: 5
Time to Execute: 15:05 ( 3:05pm )

?

yes i know how to get the local time but are you able to add an int to it?

so if the local time is

03:15 ( 3:15 am ) and i add 5 to it, it becomes
08:15 ( 8:15 am )

That's what mktime does - RTM.
localtime returns a struct tm
you then do tm->tm_hr += 5;
you then do mktime() on that to fix any day rollover (for example).

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.