Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

TRACE0

The TRACE macros are obsolete, use ATLTRACE2.

TRACE0 is similar to TRACE and is one variant of a group of trace macros that you can use for debug output.

TRACE0( 
   exp  
)

exp

A format string as used in the run-time function printf.

The group includes:

  • TRACE0   Takes a format string (Only) and can be used for simple text messages, which are dumped to afxDump.

  • TRACE1   Takes a format string plus one argument (one variable that is dumped to afxDump).

  • TRACE2   Takes a format string plus two arguments (two variables that are dumped to afxDump).

  • TRACE3   Takes a format string plus three arguments (three variables that are dumped to afxDump).

TRACE0 does nothing if you have compiled a release version of your application. As with TRACE, it only dumps data to afxDump if you have compiled a debug version of your application.

NoteNote:

This macro is available only in the debug version of MFC.

// Example for TRACE0
TRACE0( "Start Dump of MyClass members:" );

// Another example for TRACE0
// This works, but it is easier to use TRACE() or TRACE1()
DWORD dwLastError = ::GetLastError();
CString str;
str.Format("The last error code for this thread is %d\n", dwLastError);
TRACE0( (LPCTSTR) str);

// These are all normal uses of TRACE0()
TRACE0("This message will be output. ");
TRACE0("This text is on the same line.\n");
TRACE0("This text is on the next line.\n");

Header: afx.h

Community Additions

ADD
Show:
© 2015 Microsoft