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(); }
原文:http://www.cnblogs.com/luyuxibaby/p/5200661.html