C++/(MFC)Debug View 출력 Helper

stdafx.h 에 추가한다.
  1. #define _ON (0)
  2. #define _OFF (1)
  3. #define D0 _ON ? (VOID)0 : DebugView
  4. inline void DebugView(LPTSTR err, ...)
  5. {
  6.     static CString strErr;
  7.     va_list ap;
  8.     va_start(ap, err);
  9.     strErr.FormatV(err, ap);
  10.     va_end(ap);
  11.     OutputDebugString(_T("[프로젝트 이름] ") + strErr + _T("\n"));
  12. };
쓸 때는 이런 식으로 사용.
  1. D0(_T("OpenProcess=%d %s"), _ttoi(buf), _T("abcde"));

[1776] [프로젝트 이름] OpenProcess=5012 abcde

이 글에는 0 개의 댓글이 있습니다.