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);
    }
原文地址:https://www.cnblogs.com/SunkingYang/p/11049092.html