void CXX::OutputMsg01(CString tag, CString str, BOOL clean)
void CDebugProfile::OutputMsg01(CString tag , CString str , BOOL clean)
{
CString strFilePath = CDebugProfile::m_strFilePath;
strFilePath = _T("c:\\output4.txt");
CStdioFile file;
BOOL res = FALSE;
if (clean)
{
res = file.Open(strFilePath, CFile::modeCreate|CFile::modeReadWrite);
}
else
{
res = file.Open(strFilePath, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite);
}
if (res)
{
if (!clean)
{
file.SeekToEnd();
}
if (_T("")!=tag)
{
file.WriteString(tag);
file.WriteString(_T("\r\n"));
}
if (_T("")!=str)
{
char* old_locale = _strdup( setlocale(LC_CTYPE,NULL) );
setlocale( LC_CTYPE, "chs" );//设定
file.WriteString(str);//正常写入
setlocale( LC_CTYPE, old_locale );
free( old_locale );//还原区域设定
file.WriteString(_T("\r\n"));
}
file.Close();
}
}