can we force a c++ program to end after a certain amount of time
i want to force my program to quit after a certain amount of time so that it would not go on for ever..... :)
gogoc 0 Newbie Poster
Recommended Answers
Jump to PostYes.
Jump to Postuse the time() function if you only want accuracy to the second, of clock() for milliseconds.
const time_t MaxTime = 60*60; // one minute timer time_t t1 = time(0); // start the timer bool done = false; while( !done ) { time_t t2 = time(0); // get …
All 5 Replies
Narue 5,707 Bad Cop Team Colleague
twomers 408 Posting Virtuoso
gogoc 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
gogoc 0 Newbie Poster
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.