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();
}
转载于:https://www.cnblogs.com/luyuxibaby/p/5217436.html
相关资源:MFC 记录操作日志,使用Edit控件