TRACE

TRACE( exp )

Parameters

exp

Specifies a variable number of arguments that are used in exactly the same way that a variable number of arguments are used in the run-time function printf.

Remarks

Provides similar functionality to the printf function by sending a formatted string to a dump device such as a file or debug monitor. Like printf for C programs under MS-DOS, the TRACE macro is a convenient way to track the value of variables as your program executes. In the Debug environment, the TRACE macro output goes to afxDump. In the Release environment, it does nothing.

TRACE is limited to sending a total of 512 characters at a time. If you call TRACE with formatting commands, the total string length after the formatting commands have been expanded cannot be more than 512 characters, including the terminating NULL. Exceeding this limit causes an ASSERT.

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

For more information, see MFC Debugging Support in Visual C++ Programmer’s Guide.

Example

// example for TRACE
int i = 1;
char sz[] = "one";
TRACE( "Integer = %d, String = %s\n", i, sz );
// Output: 'Integer = 1, String = one'

See Also   TRACE0, TRACE1, TRACE2, TRACE3, AfxDump, afxTraceEnabled