The TRACE Macro

The TRACE macro can be used to print out debugging messages from a program during development. TRACE prints a string argument to the current diagnostic output device. For programs with character-based output in DOS, the TRACE output will go to stderr. For Windows programs, the TRACE output will be directed to your debugger.

The TRACE macro can handle different numbers of arguments, similar to the way printf operates. The following examples show several different ways to use the TRACE macros:

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 );

The TRACE macro is active only in the Debug version of the library. After a program has been debugged, you can build a Release version to inactivate all TRACE calls in the program.