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("+?????????????????????未發(fā)現(xiàn)存檔????????????????????+\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 這么長(zhǎng)的,可是輸入的卻是負(fù)數(shù),請(qǐng)教大佬
- 2 回答
- 0 關(guān)注
- 1447 瀏覽
添加回答
舉報(bào)
0/150
提交
取消