안녕하세요. 멀더입니다.
기존에 설명해주신 분도 있는데, QnA에 다시 질문이 올라 오는군요.
아래는 제가 쉽게 사용가능하도록 다시 만들어 보았습니다.
어느곳에서나 아래의 코드만 삽입하시면 만사OK... ;)
#include <windows.h>
#include <stdio.h>
class zCosoleDebugOut
{
public:
zCosoleDebugOut()
{
#ifdef _DEBUG
AllocConsole();
freopen("CONIN$","rb",stdin);
freopen("CONOUT$","wb",stdout);
freopen("CONOUT$","wb",stderr);
setbuf(stderr, 0);
#endif
}
~zCosoleDebugOut()
{
#ifdef _DEBUG
FreeConsole();
#endif
}
};
static zCosoleDebugOut zzCosoleDebugOut; // global static !!!
|