rxdebug.cpp
上传用户:rundaa
上传日期:2009-05-24
资源大小:44k
文件大小:1k
源码类别:

CAD

开发平台:

Visual C++

  1. #include "stdafx.h"
  2. #ifdef _DEBUG
  3. #include "rxdebug.h"
  4. #ifndef _WINBASE_
  5. //extracted from winbase.h so that
  6. //we don't have to pull in the whole
  7. //header
  8. extern "C"
  9. void
  10. _stdcall
  11. OutputDebugStringA(
  12.     const char* lpOutputString
  13.     );
  14. extern "C"
  15. void
  16. _stdcall
  17. OutputDebugStringW(
  18.     const unsigned short* lpOutputString
  19.     );
  20. #ifdef UNICODE
  21. #define OutputDebugString  OutputDebugStringW
  22. #else
  23. #define OutputDebugString  OutputDebugStringA
  24. #endif // !UNICODE
  25. #endif //_WINBASE
  26. // determine number of elements in an array (not bytes)
  27. #define _countof(array) (sizeof(array)/sizeof(array[0]))
  28. inline void _cdecl RxTrace(const TCHAR* lpszFormat, ...)
  29. {
  30. va_list args;
  31. va_start(args, lpszFormat);
  32. int nBuf;
  33. TCHAR szBuffer[512];
  34. nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args);
  35. // was there an error?
  36. RXASSERT(nBuf >= 0);
  37.     ::OutputDebugString(szBuffer);
  38. va_end(args);
  39. }
  40. #endif //_DEBUG, entire file