//在Windows程序中打开控制台的程序
#include
#include
#include
#include
bool CreateConsole(void)
{
FreeConsole();
if ( AllocConsole() )
{
int hCrt = _open_osfhandle((long)
GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT);
*stdout = *(::_fdopen(hCrt, "w"));
::setvbuf(stdout, NULL, _IONBF, 0);
*stderr = *(::_fdopen(hCrt, "w"));
::setvbuf(stderr, NULL, _IONBF, 0);
return TRUE;
}return FALSE;
}
阅读(1224) | 评论(0) | 转发(0) |