1:TRACE
确保TRACE宏可用:vs->tools->MFC Tracer中enable tracing框被选中。
下面是一段示例代码:
#include "stdAfx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
int x = 1;
int y = 16;
float z = 32.0;
#ifdef _DEBUG
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 );
#endif
return 0;
}
2:afxDump
可以直接在程序中使用
#include "stdAfx.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int