int n;
if ((fp = fopen("student.txt", "a")) == NULL)
{
printf("File open error!\n");
exit(1);
}
fclose(fp);
if ((fp = fopen("student.txt", "r")) == NULL)
{
printf("File open error!\n");
exit(1);
}
p1 = (struct student*)malloc(sizeof(struct student));
p1->next = NULL;
head = p1;
while (!feof(fp))
{
if (fread(p1, sizeof(struct student), 1, fp) != 1)
break;
p2 = (struct student*)malloc(sizeof(struct student));
p2->next = NULL;
p1->next = p2;
p1 = p2;
}
}
这段程序不知道什么用,有人可以看看吗
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-