So I have print function that I want to execute in 5 seconds. The Problem is that I want everything else in the function. So For example if my code is:
// insert code here...
printf("(5 seconds later) Hello"); /* should be executed in 5 seconds */
printf("heya");
In the main function for example. Now here's the tricky part. While the first line should be executed in 5 seconds, the second line should be executed just like normal if the first line wasn't there at all. So the output would be:
heya
(5 seconds later) Hello
If you familiar with Cocoa or Cocoa Touch, this is exactly how the NSTimer Class works. Using C++, is there a simpler or built in way other than using a thread? If not, how would I go about doing this using multi-threading?