// 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);
如TRACE("test\n");
使用它先在Tools->mfc tracer里给Enable tracing打勾
TRACE1
TRACE2
TRACE3...都是这系列的,因为macro不能重载嘛。:)
是不是想要的,其实VC提供的调试手段比这好多了
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);