C++通过CFile写本地日志文件

    CFile log_file;
    int log_file_opened = 0;
    void logMessage(const char * sMsg)
    {
        if(!log_file_opened)
        {
            log_file.Open("D:\\tex.log", CFile::modeCreate|CFile::modeWrite);
            log_file_opened = 1;
        }
        int len = strlen(sMsg);
        log_file.Write(sMsg, len);
    }
posted @ 2019-05-14 14:27  SunkingYang  阅读(351)  评论(0编辑  收藏  举报