GUI界面中使用printf进行输出调试

#if DEBUG


if(AllocConsole())
{
freopen("conin$","r+t",stdin);
freopen("conout$","w+t",stdout);
freopen("conout$","w+t",stderr);


HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole,FOREGROUND_GREEN);
}


_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
_CrtDumpMemoryLeaks();
#endif

你可能感兴趣的:(简单GUI调试输出)