test code

Posted on 2012-08-12 14:51 小让 阅读(398) 评论(0)  编辑 收藏 引用
 1 void CMyDlg::Log(CString strLog)
 2 {
 3     USES_CONVERSION;
 4     CString strFileName;
 5     CString strInfo;
 6     CTime ctCurrent;
 7     CString strTime;
 8     ctCurrent = CTime::GetCurrentTime();
 9     strTime = ctCurrent.Format("%m-%d %H:%M:%S");
10     strFileName.Format(TEXT("%s\\BuildLog_%s.log"), m_strConfigDir, m_strLogTime);
11     CFile file(strFileName, CFile::modeCreate | CFile::modeNoTruncate | CFile::modeReadWrite);
12     file.SeekToEnd();
13     strInfo.Format(TEXT("%s %s\r\n"),strTime, strLog);
14     CStringA strTemp = W2A(strInfo);
15     file.Write(strTemp.GetBuffer(strTemp.GetLength()), strTemp.GetLength());
16     strTemp.ReleaseBuffer();
17     file.Flush();
18     file.Close();
19 }

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


posts - 4, comments - 0, trackbacks - 0, articles - 0

Copyright © 小让