void MENU(void)
{
int number;
FILE *fp;
int t;
struct Computer *p1,*p2,*head;
p1=(struct Computer *)malloc(LEN);//malloc是分配一个不会重置的内存空间
head=p1;
if((fp=fopen("SellRecord.txt","rb"))==NULL)
{
printf(" 未找出该信息!回车键退出程序\n");
getchar();
exit(0);
}
while(!feof(fp))//非文件尾,继续执行
{
if(fread(p1,LEN,1,fp)!=1) break;
p1->next=(struct Computer *)malloc(LEN);
if(p1->next==NULL)
{
printf(" error:回车键退出程序\n");
getchar();
exit(0);
}
p2=p1;
p1=p1->next;
}
p2->next=NULL;
fclose(fp);
system("CLS");

为什么head=p1呀 if(fread(p1,LEN,1,fp)!=1)为什么不等于1的时候跳出
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-