1. 다음과 같이 stdafx.cpp에 또는 *.cpp 아무곳에 다음을 추가한다.
#ifdef UNICODE #pragma comment(linker, "/entry:wWinMainCRTStartup /subsystem:console") #else #pragma comment(linker, "/entry:WinMainCRTStartup /subsystem:console") #endif |
* cmd창에 한글을 출력하려면 다음과 같이 설정해야 한다.
#include <locale.h> _tsetlocale(LC_ALL, _T("korean")); // cmd창 한글 출력 |
2. VC6++ 인경우
LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
AllocConsole();
freopen ("CONOUT$", "w", stdout );
}
실행하면 다음 그림과 같이 콘솔이 띄며, 프로그램에서 printf()함수를 사용이 가능하다.

카페 게시글
MFC와 OpenCV
MFC에서 콘솔창 (console, command) 띄우기
한창호
추천 0
조회 323
15.10.29 15:16
댓글 0
다음검색