CString strtemp,str;
while(!feof(fpOntology))
{
if((c=fgetc(fpOntology))!='\n')
{
tempword[i++]=c;
}
else
{
strtemp.Format("%s",tempword);
p=(OntologyNode *)malloc(sizeof(OntologyNode));
index=strtemp.Find('\t');
str=strtemp.Left(index); //出错的地方
p->member1=new char(30);
strcpy(p->member1,str);
.
...........
}
} 从文件中读出每一行,然后把每一行的单词按'\t',分出一个一个单词,
可是读到第5行的时候,也就是循环5次的时候, str=strtemp.Left(index);就出现错误,File:dbgheap.c,Line:1017.
断点调试时,进入: pPrev->pEntryPrev->pEntryNext = pPrev->pEntryNext; 请VC高手们指教!!!
while(!feof(fpOntology))
{
if((c=fgetc(fpOntology))!='\n')
{
tempword[i++]=c;
}
else
{
strtemp.Format("%s",tempword);
p=(OntologyNode *)malloc(sizeof(OntologyNode));
index=strtemp.Find('\t');
str=strtemp.Left(index); //出错的地方
p->member1=new char(30);
strcpy(p->member1,str);
.
...........
}
} 从文件中读出每一行,然后把每一行的单词按'\t',分出一个一个单词,
可是读到第5行的时候,也就是循环5次的时候, str=strtemp.Left(index);就出现错误,File:dbgheap.c,Line:1017.
断点调试时,进入: pPrev->pEntryPrev->pEntryNext = pPrev->pEntryNext; 请VC高手们指教!!!
str=strtemp.Left(index); //出错的地方 判断一下 index 是否为 -1
Cstring::Find 如果找不到指定的字符,会返回 -1 的
应该是 p->member1=new char[30];
遇到这种 提示问题所在行的
在这一行加断点
单步运行
看数值 是否合法 然后做相应修改
这是调试最基本的方式
还有那个i好像没初始化
应该是 p->member1=new char[30];
马上给分