#include <string>
#include <fstream>
static std::ofstream g_log("111111.log");//指定到out.log文件夹
std::cout.rdbuf(g_log.rdbuf());
cout中文乱码解决:
#include "stdafx.h"
#include <Windows.h>
#include <iostream>
system("chcp 65001");
std::cout<< "你好,中国"<< std::endl;
system("pause");