void WriteLog(LPCTSTR pFormat,...);
void WriteLog(LPCTSTR pFormat,...)
{
TCHAR chMsg[4096];
va_list pArg;
va_start(pArg,pFormat);
_vstprintf(chMsg,pFormat,pArg);
va_end(pArg);
SYSTEMTIME st;
::GetLocalTime(&st);
char logname[4096];
memset(logname,'/0',MAX_PATH);
sprintf(logname,"%s%04d-%02d-%02dlog.txt",m_logpath.GetBuffer(m_logpath.GetLength()),st.wYear,st.wMonth,st.wDay);
CStdioFile f;
if(!f.Open( logname, CFile::modeCreate | CFile::modeWrite|CFile::modeNoTruncate|CFile::typeText))
{
DWORD dwVal =::GetLastError();
#ifdef _DEBUG
afxDump << "Unable to open file" << "/n";
#endif
return;
}
f.SeekToEnd();
char tmp[2048];
sprintf(tmp,"%s/t......../t%02d:%02d:%02d.%03d",chMsg,st.wHour,st.wMinute,st.wSecond,st.wMilliseconds);
f.WriteString(tmp);
f.WriteString("/r/n");
f.Close();
}