Release下支持调试信息的打印,Debug_Trace的实现

 

主要用到OutputDebugString函数,直接看代码。

 

Debug_Trace.h

#if !defined(DEBUG_TRACE_INCLUDE_)
#define  DEBUG_TRACE_INCLUDE_

#include 
#include 
#include  

void	Debug_TraceA(char* fmt, ...);
void	Debug_TraceW(WCHAR* fmt, ...);

#endif

 

Debug_Trace.cpp

 

#include "Debug_Trace.h"


void Debug_TraceA(char* fmt, ...)
{
	char buf[32*1024]	= {0};
	va_list args;
	va_start( args, fmt );
	vsprintf( buf, fmt, args );
	va_end( args );

	OutputDebugStringA( buf );
}

void Debug_TraceW(WCHAR* fmt, ...)
{
	WCHAR buf[1024] = {0};
	va_list args;
	va_start( args, fmt );
	vswprintf( buf, fmt, args );
	va_end( args );

	OutputDebugStringW( buf );
}


 

你可能感兴趣的:(include,list)