00001 #ifndef _DEBUGUTIL_H_
00002 #define _DEBUGUTIL_H_
00003
00004 #include <stdio.h>
00005 #include <stdarg.h>
00006
00007 #ifdef _WIN32
00008 #include <Windows.h>
00009 #endif
00010
00011 class DebugUtil
00012 {
00013 public:
00014 DebugUtil() {}
00015 ~DebugUtil() {}
00016
00017 static void outputDebugText(const char *str, ...)
00018 {
00019 #ifdef _DEBUG
00020 char* pBuf = 0;
00021
00022 va_list args;
00023 va_start(args,str);
00024
00025 #ifdef _WIN32
00026 size_t len = _vscprintf( str, args ) + 1;
00027 pBuf = new char[len];
00028 vsprintf_s( pBuf, len, str, args );
00029 OutputDebugStringA(pBuf);
00030 #else
00031 pBuf = new char[2048];
00032 vsprintf(pBuf,str,args);
00033 printf(pBuf);
00034 #endif //#ifdef _WIN32
00035
00036 #endif //#ifdef _DEBUG
00037 }
00038 };
00039
00040 #endif