bool CMy989Dlg::WriteLog(CString str)
{
CString strWorkPath;
CString strWorkPathlog;
TCHAR tszWorkPath[MAX_PATH];
GetModuleFileName(NULL, tszWorkPath, MAX_PATH);
strWorkPath.Format(_T("%s"),tszWorkPath) ;
int num = strWorkPath.ReverseFind(_T('//'));
strWorkPath = strWorkPath.Left(num);
strWorkPathlog=strWorkPath;
strWorkPathlog+=_T("//writelog.TXT");
CStdioFile file;
//if (file.Open(filenpath,CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite|CFile::typeText)==0)
if (file.Open(strWorkPathlog,CFile::modeCreate|CFile::modeNoTruncate|CFile::modeWrite)==0)
return false;
file.SeekToEnd(); //写追加在以前写的后面
CTime time=CTime::GetCurrentTime();
str= _T("[%m/%d %H:%M:%S] ")+str;
str=time.Format(str);
str+=_T("/n");
file.WriteString(str);
file.Close();
return true;
}