#include <io.h>
#include <fcntl.h>
#include <fcntl.h>
#include <stdio.h>
void InitConsoleWindow()
{
int nCrt = 0;
FILE* fp;
AllocConsole();
nCrt = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
fp = _fdopen(nCrt, "w");
*stdout = *fp;
setvbuf(stdout, NULL, _IONBF, 0);
}
在主程序初始化的地方加入上面了函数