zoukankan      html  css  js  c++  java
  • MFC_VC++fopen_s打开网路路径文件,保存信息日志

    fopen_s打开网路路径文件,保存信息日志

    FILE *pFileHandle1 = NULL;
        try
        {
        
         if (_access("\\\\172.17.140.245\\dfnssawdata\\loger\\", 0) != 0)
            CreateDirectory(_T("\\\\172.17.140.245\\dfnssawdata\\"), NULL);
         sprintf_s(szLogFilePath, "\\\\172.17.140.245\\dfnssawdata\\loger\\%04d_%02d_%02d_%02d.log", sysTime.wYear, sysTime.wMonth, sysTime.wDay, sysTime.wHour);
         fopen_s(&pFileHandle1, szLogFilePath, "a+b");
         if (pFileHandle1 == NULL)
         {
            m_strLogList.RemoveAll();
            return;
         }
         pPos = m_strLogList.GetHeadPosition();
         while (pPos)
         {
            strLogInfo = m_strLogList.GetNext(pPos);
            fprintf_s(pFileHandle1, "%s\r\n", _bstr_t(strLogInfo).operator const char*());
         }
         m_strLogList.RemoveAll();
        fclose(pFileHandle1);
        }
        catch(CFileException ex1)
        {
            MessageBox(L"网络错误,无法访问172.17.140.245");
        }
    
        
    欢迎讨论,相互学习。 txwtech@163.com
  • 相关阅读:
    [PA2014]Muzeum
    [AMPPZ2014]Jaskinia
    [PA2015]Rozstaw szyn
    LOJ 6713 「EC Final 2019」狄利克雷 k 次根 加强版
    Problem. R
    51nod 2583 数论只会Gcd
    51nod 1847 奇怪的数学题
    51nod 1575 Gcd and Lcm
    Problem. Q
    CF868G El Toll Caves
  • 原文地址:https://www.cnblogs.com/txwtech/p/15565763.html
Copyright © 2011-2022 走看看