在应用程序初始化的地方加上: 
AllocConsole(); // 将当前程序附着到父进程上

 freopen("CONIN$", "r+t", stdin); // 重定向 STDIN
 freopen("CONOUT$", "w+t", stdout); // 重定向STDOUT


本文链接地址: 在GUI程序中使用printf与cout等控制台输出函数
https://blog.qingfengju.com/index.asp?id=255

分类:Win32/C++ 查看次数:8819 发布时间:2011/6/29 23:20:28