This is the WriteAppLog code I used to create a log that app produces but I want to override the previous log OR create a new file with a new name every time.
Can someone help me modify?
void WriteAppLog (const std::string &s) { std::ofstream file ("AppLog.txt", std::ios::app); file << "[" << Helper::DateTime().GetDateTimeString () << "]" << "\n" << s << std::endl << "\n"; file.close(); }
file.close(), the stream closes itself when going out of scope.