From 4014066eedb713b2ba1c9409824ee148911db2e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E8=89=BA=E5=93=B2?= <446062334@qq.com> Date: Sun, 21 May 2023 16:02:03 +0800 Subject: [PATCH] save --- README.md | 2 +- images/save.svg | 192 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 193 insertions(+), 1 deletion(-) create mode 100644 images/save.svg diff --git a/README.md b/README.md index b845ebf..65f8650 100644 --- a/README.md +++ b/README.md @@ -418,6 +418,6 @@ C9:Reader* LendBook(Reader* reader, Book* book);\\读者借书 C10:void returnBook(Reader* reader, Book* book);\\读者还书 ![C10](images/returnBook.svg) C11:void save(Book* book);\\文件保存 - +![C11](images/save.svg) C12:Book* read1();\\从文件读取 diff --git a/images/save.svg b/images/save.svg new file mode 100644 index 0000000..222824b --- /dev/null +++ b/images/save.svg @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + 开始 + + + + + + 结束 + + + + + + + + + + + + + + + + + + + + + Book* pCur = book1 + + + + + + iCount = 0 + + + + + + + + + + + + + pCur == NULL + + + + + + 输出 ("\n 没有学生记录!\n") + + + + + + + + + + + + + + + + + + + + + + + (fp = fopen("book.txt", + "wb")) == NULL + + + + + + + + + + + 输出 ("创建文件失败!\n") + + + + + + + + getchar() + + + + + + + + exit(1) + + + + + + + + + + + + + + + + + + + + + + + + + + + fwrite(pCur, sizeof(Book), 1, + fp) + + + + + + pCur = pCur->next + + + + + + + pCur + + + + + + + + + + + + + 输出 "\n" + + + + + + 输出 + ("保存文件的数据数目为:% + d\n",iCount) + + + + + + + + fclose(fp) + + + + + -- 2.34.1