struct student *read_file(){
int i=0;
struct student *p1=NULL,*head=NULL,*p2=NULL;
FILE *pfile;
pfile = fopen("student.txt","r");
if(pfile == NULL)
{
printf("+ 未发现存档 +\n");
return 0;}
while(!feof(pfile)){
p1 = (struct student*)malloc(LEN);
fscanf(pfile,"%d%d%d%s%s%s%s%s",&p1->idnum,&p1->cardnum,&p1->date,p1->school,p1->sex,
&p1->major,&p1->iden,p1->name);
p1->next=NULL;
if(i==0) head=p1;
else p2->next=p1;
p2=p1;
i++;}
fclose(pfile);
printf("+ 读档成功 +\n");
return head;}我的idnum是201820020304 这么长的,可是输入的却是负数,请教大佬
2 回答
- 2 回答
- 0 关注
- 1420 浏览
添加回答
举报
0/150
提交
取消