MFC 保存运行日志
void WriteLog(CString Msg) { CTime tm =CTime::GetCurrentTime(); CString str = tm.Format("%Y-%m-%d-%H-%M-%S"); CString sPage = str + " "+Msg+"r"+"n"; CFile logfile (_T("C:\RunLog.log"), CFile::modeNoTruncate|CFile::modeReadWrite|CFile::modeCreate); logfile.SeekToEnd(); logfile.Write(sPage,sPage.GetLength()); logfile.Flush(); logfile.Close(); }