/* 
Trace.h
*/

#ifndef __TRACE_H__
#define __TRACE_H__

#include 
<crtdbg.h>
#include 
<stdarg.h>
#include 
<stdio.h>
#include 
<string.h>
#pragma warning(disable : 4996)

#ifdef _DEBUG
#define TRACEMAXSTRING    1024

inline 
void Trace(const char* format,...)
{
    
static char szBuffer[TRACEMAXSTRING];
    va_list args;
    va_start(args,format);
    
int nBuf;
    nBuf 
= _vsnprintf(szBuffer,
        TRACEMAXSTRING,
        format,
        args);
    va_end(args);

    _RPT0(_CRT_WARN,szBuffer);
}
#define TraceEx _snprintf(szBuffer,TRACEMAXSTRING,"%s(%d): ", \
    
&strrchr(__FILE__,'\\')[1],__LINE__); \
    _RPT0(_CRT_WARN,szBuffer); \
    Trace

#else
inline 
void Trace(0);
inline 
void TraceEx(0);
#endif


#endif // __TRACE_H__

相关文章:

  • 2021-09-23
  • 2021-09-13
  • 2021-12-27
  • 2021-11-18
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-07
  • 2021-05-24
  • 2022-02-18
  • 2021-08-08
  • 2022-12-23
  • 2021-09-20
相关资源
相似解决方案