#include "StdAfx.h"
#include "Console4GUI.h"
Console4GUI::Console4GUI(void)
{
AllocConsole(); // Create a new console window
int hCrun;
hCrun = _open_osfhandle((long)GetStdHandle(STD_OUTPUT_HANDLE),_O_TEXT);
FILE *file = _fdopen(hCrun, "w");
// use default stream buffer
setvbuf(file, NULL, _IONBF, 0);
*stdout = *file;
std::cout<<"控制台启动"<<std::endl;
}
Console4GUI::~Console4GUI(void)
{
FreeConsole(); // Close the console window
}
#pragma once
#include <fcntl.h>
#include <io.h>
#include <iostream>
class Console4GUI
{
public:
Console4GUI(void);
~Console4GUI(void);
};