调试

DbgPrint.h

 1 #ifndef _DEBUG_PRINT
 2 #define _DEBUG_PRINT
 3 
 4 #ifdef _DEBUG
 5 
 6 inline void _DebugPrintf(LPCTSTR szFormat,...){
 7     TCHAR szBuf[1024] = {0};
 8 
 9     va_list arg_ptr;
10     va_start(arg_ptr,szFormat);
11     _vstprintf_s(szBuf,MAX_PATH,szFormat,arg_ptr);
12     va_end(arg_ptr);
13     OutputDebugString(szBuf);
14 }
15 
16 #    define DbgPrint(wstr) OutputDebugString(wstr)
17 #    define DbgPrintf(format,...) _DebugPrintf(format,__VA_ARGS__)
18 
19 #else
20 
21 #    define DbgPrint(wstr) 
22 #    define DbgPrintf(format,...)
23 
24 #endif //_DEBUG
25 
26 
27 #endif //_DEBUG_PRINT
原文地址:https://www.cnblogs.com/aishangxue/p/OutputDebugString.html