b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

First-chance exception in main.exe

电脑杂谈  发布时间:2020-02-23 19:01:30  来源:网络整理

fscanf 0x_access violation at 0x_fscanf 0x

First-chance exception in main.exe: 0xC0000005: Access Violation.的难题,急需回答啊求他们了

#include"head.h"

CLASS*head=NULL,*point_class_save,*point_class_go;

FILE*fp=NULL;

externFILE*fp22;

externFILE*fp33;

externFILE*fp44;

voidbuild_class()

{

charclass_fall[20];

if(fp==NULL)

fscanf 0x_access violation at 0x_fscanf 0x

{

if((fp=fopen("classes.txt","r"))==NULL)

{

printf("Fileopenerror!\n");

exit(0);

}

}

if(fscanf(fp,"%s",class_fall)==4)

{

if(head==NULL)

{

fscanf 0x_access violation at 0x_fscanf 0x

head=(CLASS*)malloc(sizeof(CLASS));

strcpy(point_class_save->class_no,class_fall);

point_class_save=head;

point_class_save->next1=NULL;

}

else

{

point_class_go=(CLASS*)malloc(sizeof(CLASS));

point_class_go->next1=NULL;

point_class_save->next1=point_class_go;

point_class_save=point_class_go;

access violation at 0x_fscanf 0x_fscanf 0x

strcpy(point_class_save->class_no,class_fall);

}

build_student();

}

else

{

fclose(fp);

fclose(fp22);

fclose(fp33);

fclose(fp44);

return;

access violation at 0x_fscanf 0x_fscanf 0x

}

}

这是错误那个文件fscanf 0x,运行到if(fscanf(fp,"%s",class_fall)==4)出现First-chanceexceptioninmain.exe:0xC0000005:AccessViolation.不知道什么回事,求解啊大神们,急急急!!!!

------解决方案--------------------

引用:可以加你qq吗,教下我,急需帮助啊

帮你试了一下,没问题。


#include <cstdio>
#include <cstdlib>

FILE *fp=NULL;
void build_class()
{
 char class_fall[20];
 if(fp==NULL)
 {
  if((fp=fopen("classes.txt","r"))==NULL)
  {
   printf("File open error!\n");
   exit(0);
  }
 }
 if(fscanf(fp,"%s",class_fall)==1)
 {
  printf("%s\n",class_fall);
 }
 else
 {
  fclose(fp);
  return ;
 }
}

int main ()
{
 build_class();
}

下面是我classses.txt的内容


0510

ps.fscanf返回成功读取的数组数目fscanf 0x,不是字节数目。

ps.木有qq.

------解决方案--------------------

引用:你是神啊!!!真的是啊谢谢你啊

是你的基础知识不认真呀。求结贴给分。。。。


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-141823-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      • 王银银
        王银银

        那我想问一下官网一共才卖了多少手机

      • 贺及
        贺及

        很好听

      热点图片
      拼命载入中...