The TRACE Macro
This topic applies to:
Edition |
Visual Basic |
C# |
C++ |
Web Developer |
---|---|---|---|---|
Express |
Native only |
|||
Standard |
Native only |
|||
Pro and Team |
Native only |
Table legend:
Applies |
|
Does not apply |
|
Command or commands hidden by default. |
To display messages from your program in the debugger Output window, you can use the ATLTRACE macro or the MFC TRACE macro. Like assertions, the trace macros are active only in the Debug version of your program and disappear when compiled in the Release version.
The following examples show some of the ways you can use the TRACE macro. Like printf, the TRACE macro can handle a number of arguments.
int x = 1;
int y = 16;
float z = 32.0;
TRACE( "This is a TRACE statement\n" );
TRACE( "The value of x is %d\n", x );
TRACE( "x = %d and y = %d\n", x, y );
TRACE( "x = %d and y = %x and z = %f\n", x, y, z );
For more information on the TRACE macro, see Diagnostic Services.