急!在MFC中出现 (msvcr100d.dll) 处有未经处理的异常: 0xC0000005: 写入位置 0x001ee07c 时发生访问冲突 5
intcode,i=0,j=0,k=0;charsuffix[6]=".dxf";strcat("filename",suffix);dxf=fopen("filenam...
int code,i=0,j=0,k=0;
char suffix[6]=".dxf";
strcat("filename",suffix);
dxf=fopen("filename","r");
if (dxf==NULL)
{
exit(0);
}
entity=entity2=(EntityData*)malloc(DATASIZE);
while (feof(dxf)==0)
{fscanf_s (dxf,"%d",&code);
fscanf_s (dxf,"%s",codevalue);
if (code==2 && strcmp(codevalue,"ENTITIES")==0)
{ while (strcmp(codevalue,"ENDSEC"))
{ fscanf_s (dxf,"%d",&code);
fscanf_s (dxf,"%s",&codevalue);
if (code==0 && strcmp(codevalue,"LINE")==0)
{ entity1=(EntityData*)malloc(DATASIZE);
strcpy_s(entity1->id,codevalue);
fscanf_s(dxf,"%d",&code);
while (code)
{switch (code)
{case 10:
fscanf_s(dxf,"%f",&value);
fscanf_s(dxf,"%d",&code);
entity1->data.line.X1=value;
break;
case 20:
fscanf_s(dxf,"%f",&value);
fscanf_s(dxf,"%d",&code);
entity1->data.line.Y1=value;
break;
case 11:
fscanf_s(dxf,"%f",&value);
fscanf_s(dxf,"%d",&code);
entity1->data.line.X2=value;
break;
case 21:
fscanf_s(dxf,"%f",&value);
fscanf_s(dxf,"%d",&code);
entity1->data.line.Y2=value;
break;
default:
{fscanf_s(dxf,"%s",codevalue);
fscanf_s(dxf,"%d",&code);
}
}
}
entity2->next=entity1;
entity2=entity1;
} 展开
char suffix[6]=".dxf";
strcat("filename",suffix);
dxf=fopen("filename","r");
if (dxf==NULL)
{
exit(0);
}
entity=entity2=(EntityData*)malloc(DATASIZE);
while (feof(dxf)==0)
{fscanf_s (dxf,"%d",&code);
fscanf_s (dxf,"%s",codevalue);
if (code==2 && strcmp(codevalue,"ENTITIES")==0)
{ while (strcmp(codevalue,"ENDSEC"))
{ fscanf_s (dxf,"%d",&code);
fscanf_s (dxf,"%s",&codevalue);
if (code==0 && strcmp(codevalue,"LINE")==0)
{ entity1=(EntityData*)malloc(DATASIZE);
strcpy_s(entity1->id,codevalue);
fscanf_s(dxf,"%d",&code);
while (code)
{switch (code)
{case 10:
fscanf_s(dxf,"%f",&value);
fscanf_s(dxf,"%d",&code);
entity1->data.line.X1=value;
break;
case 20:
fscanf_s(dxf,"%f",&value);
fscanf_s(dxf,"%d",&code);
entity1->data.line.Y1=value;
break;
case 11:
fscanf_s(dxf,"%f",&value);
fscanf_s(dxf,"%d",&code);
entity1->data.line.X2=value;
break;
case 21:
fscanf_s(dxf,"%f",&value);
fscanf_s(dxf,"%d",&code);
entity1->data.line.Y2=value;
break;
default:
{fscanf_s(dxf,"%s",codevalue);
fscanf_s(dxf,"%d",&code);
}
}
}
entity2->next=entity1;
entity2=entity1;
} 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励10(财富值+成长值)+提问者悬赏5(财富值+成长值)
1个回答
展开全部
这应该是引用空指针引起的,建议设置断点跟踪调试。
追问
我在C++6.0里能够运行,怎么到VS2010中会出现问题,这个问题我好像给解决了,但是运行
strcmp(pointer->id,"LINE")是又出现
CAM.exe 中的 0x57bad484 (msvcr100d.dll) 处有未经处理的异常: 0xC0000005: 读取位置 0xcdcdcdcd 时发生访问冲突
这是怎么回事???
追答
会不会是这个库的原因msvcr100d.dll。试一试使用vc6进行静态链接再运行看一看。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询