请教afxDump.setdepth()函数的用法
看了一下MSDN,大概明白了这个函数的功能,写了一个小例子想验证一下
int A[5];
for(int i=0;i<5;i++)
{
A[i]=i;
}
#ifdef _DEBUG
afxDump<< "File could not be opened " <<"\n";
afxDump.SetDepth(0);
afxDump<<A;
afxDump.SetDepth(1);
afxDump<<A;
afxDump.Flush();
#endif
但在DEBUG里窗口里看到的全是A的地址。请问
1、不用循环是否能全部看到数组的值
2、哪位大虾能给出一个合适的例子说明setdepth(0)和setdepth(1)的不同影响/
问题点数:100、回复次数:8Top
1 楼flyelf(空谷清音)回复于 2003-12-02 16:23:28 得分 10
if(afxDump.GetDepth() == 0)
afxDump<<A;
else if(afxDump.GetDepth() == 1)
afxDump<<B;Top
2 楼laomai(老迈)回复于 2003-12-02 16:40:04 得分 0
flyelf(空谷清音)
那A和B又分别是什么?呵呵Top
3 楼nonocast(如果没有如果)回复于 2003-12-02 17:03:25 得分 10
class A
{
int x;
};
class B
{
A a;
}
如果SetDepth(1)的时候就能序列化B中的a
否则则不能Top
4 楼laomai(老迈)回复于 2003-12-02 17:23:53 得分 0
nonocast(如果没有如果) ,能给出具体的源代码吗?
我如果直接写
class A
{
int x;
};
A a;
afxDump<<a;
提示报错:-(
Top
5 楼laomai(老迈)回复于 2003-12-03 13:37:52 得分 0
nonocast(如果没有如果)
好事做到底,能给一个实际的代码吗,体现出setdepth(0)和setdepth(1)的不同作用?
谢谢!Top
6 楼laomai(老迈)回复于 2003-12-04 17:59:55 得分 0
自己顶一下Top
7 楼carbon107(<软件开发思想.h>)回复于 2004-01-05 16:51:30 得分 80
#ifdef _DEBUG
afxDump<<x;
#endif
将结果显示在OutPut,不能在Release状态下。Ctrl+F5似乎无效,F5可以。
afxDump.SetDepth(1);
设置深度,如maps,arrays,它只打出有几个可元素,我们用上面的这个函数,它会将所有的内容打出来.
#ifdef _DEBUG
char test[] = "0123456789\n";
afxDump.HexDump( "--", (BYTE*) test, 11, 6 );
#endif
结果为:
-- 30 31 32 33 34 35
-- 36 37 38 39 0A
第一个参数,行首的打头字符.
第二个参数,要打的内容.
第三个参数,要打的元素个数.
第四个参数,每行的个数.
Top
8 楼carbon107(<软件开发思想.h>)回复于 2004-01-05 16:53:11 得分 0
不用循环可以全部看到数组的值
Top




