I've been using something somewhat like this to keep track of time for a program, and it works fine... except that it seems to eat up all the computer's resources. Does anyone know how to have a program stay on a schedule while running in the background without sucking up all the computer's power?
Code:while(!compareTime(timeH, timeM)); cout << "End of job."; bool compareTime(int timeH, int timeM) { int timeH_now; int timeM_now; ofstream currentOut("current.txt"); time_of_day now; now.get_time_string(); currentOut << now.hour << " " << now.minute; currentOut.close(); ifstream currentIn("current.txt"); currentIn >> timeH_now >> timeM_now; currentIn.close(); if(timeH_now == timeH && timeM_now == timeM) return true; else return false; }