本方法简单易用,适用于VC6、VC.NET2003 假定你创建的VC应用程序叫做ImageFilter,那么只需添加如下代码即可: [1] 打开ImageFilter.cpp文件,增加 #include <io.h> #include <fcntl.h> void InitConsole() { int hCrt; FILE *hf; AllocConsole(); hCrt = _open_osfhandle( (long)GetStdHandle(STD_OUTPUT_HANDLE), _O_TEXT ); hf = _fdopen( hCrt, "w" ); *stdout = *hf; setvbuf( stdout, NULL, _IONBF, 0 ); printf("InitConsoleWindow OK!\n\n"); } [3] 在函数'BOOL CImageFilterApp::InitInstance()'调用该函数:

评论