CAFE

MFC와 OpenCV

MFC에서 콘솔창 (console, command) 띄우기

작성자한창호|작성시간15.10.29|조회수281 목록 댓글 0

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()함수를 사용이 가능하다.



다음검색
현재 게시글 추가 기능 열기
  • 북마크
  • 신고 센터로 신고

댓글

댓글 리스트
맨위로

카페 검색

카페 검색어 입력폼