dumpout.cpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. #include "stdafx.h"
  11. #include <stdarg.h>
  12. #ifdef _DEBUG // entire file
  13. #ifdef AFX_AUX_SEG
  14. #pragma code_seg(AFX_AUX_SEG)
  15. #endif
  16. #ifdef _DEBUG
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. // Helper routines that can be called from debugger
  22. void AFXAPI AfxDump(const CObject* pOb)
  23. {
  24. afxDump << pOb;
  25. }
  26. /////////////////////////////////////////////////////////////////////////////
  27. // Diagnostic Trace
  28. void AFX_CDECL AfxTrace(LPCTSTR lpszFormat, ...)
  29. {
  30. #ifdef _DEBUG // all AfxTrace output is controlled by afxTraceEnabled
  31. if (!afxTraceEnabled)
  32. return;
  33. #endif
  34. va_list args;
  35. va_start(args, lpszFormat);
  36. int nBuf;
  37. TCHAR szBuffer[512];
  38. nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args);
  39. // was there an error? was the expanded string too long?
  40. ASSERT(nBuf >= 0);
  41. if ((afxTraceFlags & traceMultiApp) && (AfxGetApp() != NULL))
  42. afxDump << AfxGetApp()->m_pszExeName << ": ";
  43. afxDump << szBuffer;
  44. va_end(args);
  45. }
  46. #endif //_DEBUG
  47. /////////////////////////////////////////////////////////////////////////////