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();
 }
}

相关文章:

  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2021-11-24
  • 2021-09-07
  • 2021-08-20
  • 2022-01-22
猜你喜欢
  • 2022-12-23
  • 2022-01-17
  • 2021-12-16
  • 2022-12-23
  • 2021-10-19
  • 2021-08-09
相关资源
相似解决方案