和printf 提供的功能类似,但是TRACE输出到system debugger的debug output窗口,典型的system debugger就是VC(还有windbg, dbgviewer等等)
// example for TRACE
int i = 1;
char sz[] = "one";
TRACE( "Integer = %d, String = %s\n", i, sz );
// Output到vc的debug output窗口: 'Integer = 1, String = one'
// example for TRACE
int i = 1;
char sz[] = "one";
TRACE( "Integer = %d, String = %s\n", i, sz );
// Output到vc的debug output窗口: 'Integer = 1, String = one'
// example for TRACE
int i = 1;
char sz[] = "one";
TRACE( "Integer = %d, String = %s\n", i, sz );
// Output: 'Integer = 1, String = one'// another example for TRACE
// Note that the TRACE() macro accepts a LPCTSTR for the format string
// parameter, while the other TRACEn() macros accept a LPCSTR.
// This means that you should use the _T() macro on formatting strings
// you supply if you want to build both _UNICODE and non-_UNICODE from
// the same source.TRACE(_T("Hockey is best!\n"));// remember to include <stdlib.h> to get rand() and its friendsint nCount = rand();
TRACE(_T("There are %d fans at this moment.\n"), nCount);