afxDump怎么用

来源:互联网 发布:学python往哪方面就业 编辑:程序博客网 时间:2024/06/10 21:28

afxDump怎么用

#ifdef _DEBUG

   afxDump << "File could not be opened " << e.m_cause << "\n";
#endif
afxDump
CDumpContext afxDump;
说明:
使用这个变量为你的应用程序提供基本的对象转储能力。afxDump是预定义的CDumpContext对象,它使你能够将CDumpContext信息发送到调试器输出窗口或者调试终端。通常把afxDump作为CObject::Dump的一个参数。
在Windows NT和Windows 95(以及Windows的早期版本)中,当你调试应用程序时,afxDump输出被发送到Visual C++的调试输出窗口。
这个变量仅在MFC的调试版本中定义。有关afxDump的更多信息请参见《VisualC++程序员指南》中的“MFC调试支持”。Visual C++连接文档中的“技术注释7”和“技术注释12”中包含了其它一些信息。
注意:这个函数仅在MFC的调试版本中起作用。
示例:
// afxDump的示例
// example for afxDump
CPerson myPerson = new CPerson;
// set some fields of the CPerson object...
//..
// now dump the contents
#ifdef _DEBUG
afxDump << \"Dumping myPerson:\\n\";
myPerson->Dump( afxDump );
afxDump << \"\\n\";
#endif
void AfxDump(const CObject* pOb);
参数: pOb 指向由CObject继承的类的对象的指针。


说明编辑
在调试器中调用这个函数以在调试时转储对象的状态。AfxDump调用一个对象的Dump函数并且将信息发送到afxDump变量指定的位置。AfxDump仅能在MFC的调试版本中使用。
在你编译和运行debug版的程序时从VC的Debug窗口输出信息,你就当一个全局变量吧。实际也是,不过只在DEBUG版时才有。 和TRACE差不多,只不过TRACE用的是printf 的参数格式。 afxDump重载了<<。


0 0
原创粉丝点击