带dos调试窗口的win32程序

#include <locale.h>


#define CREATE_DEBUG_CONSOLE \
FILE* fpDebugOut = NULL; \
FILE* fpDebugIn = NULL; \
FILE* fpDebugErr = NULL; \
if( !AllocConsole() ) \
MessageBox(NULL, _T("控制台生成失败。"), NULL, 0); \
SetConsoleTitle(_T("Debug Window")); \
_tfreopen_s(&fpDebugOut, _T("CONOUT$"),_T("w"), stdout); \
_tfreopen_s(&fpDebugIn, _T("CONIN$"), _T("r"), stdin); \
_tfreopen_s(&fpDebugErr, _T("CONOUT$"),_T("w"), stderr); \
_tsetlocale(LC_ALL, _T("chs"));




#define RELEASE_DEBUG_CONSOLE \
fclose(fpDebugOut); \
fclose(fpDebugIn); \
fclose(fpDebugErr); \
FreeConsole();

你可能感兴趣的:(dos,File,null,include)