Need C++ functions (I'm a beginner)

Basically, there's stuff I want to do, and stuff I know I can do, I just don't know how to do then with C++.

Firstly, I need a C++ version of soemthing like the JavaScript setInterval() function. Is there one in existence or something that can emulate that effect?

That's really all I need for now, but I can guaruntee I'll be back.
If you're expecting someone to go and Google what that function does, you'll be waiting a long time for a reply.
Are you looking for a function to execute something at a specific time (8:30pm) or repeat execution at specific time intervals (every 5 minutes)?

Also, take a look here: http://www.cplusplus.com/reference/clibrary/ctime/
Last edited on
Helios,

I wasn't waiting for someone to Google, I didn't think about people not knowing it. That's my bad. You sound a little crude about your answer. Please have a little more respect and ask what it does next time if you don't know.

It's syntax looks like setInterval(*function to be repeated*, *time between each repeat in milliseconds*).

For example, setInterval("myFunction()", 5000) would load myFunction() every 5 seconds from the time setInterval() is called. It can be stopped with clearInterval().

Return 0,

I was looking for something that would launch a function every so many seconds. I Googled and didn't find anything, so I'll probably have to build one.

In case you're wondering what it's for, I'm building a DOS real time battle tourney type of thing. Something a friend and I wanted to do to learn the language, because we learn by coming up with a project and doing it. That's how I learned the other languages I know. I'm sure I can come up with something. I was just curious on if something existed before I built one. No use reinventing the wheel, right?
Last edited on
I've never tried to do that before, however, I recall that SDL (Google it) had a Timer subsystem with functions for this very purpose.
Topic archived. No new replies allowed.