qq_25971461
qq_25971461
2021-01-19 22:14

C语言链表文件存储多出乱行

  • c语言

void keep(A *head)
{
  FILE *fp;
  A *cur = head->next;

  if ((fp = fopen("E:\\information.txt", "wb")) == NULL)
    printf("Save default!!!\n");
  while (cur)
  {
    fprintf(fp, "%d,%s,%s,%f,%f,%f,%f,%d\n ", cur->identifer, cur->name, cur->nature, cur->time_sum, cur->time_lesson, cur->time_practice, cur->credit, cur->term);
    cur = cur->next;
  }
  fclose(fp);
  printf("存档成功!\n");
}
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答