From 5970b43f6184ef77c689297f6cff35038313e6db Mon Sep 17 00:00:00 2001 From: landrin Date: Fri, 25 Oct 2024 22:35:10 +0200 Subject: [PATCH] correction final historique partie --- pendu.c | 4 ++-- save_party.txt | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pendu.c b/pendu.c index c8bb158..0f9f56c 100644 --- a/pendu.c +++ b/pendu.c @@ -54,13 +54,12 @@ void save_party(char * status, const char * good_word, char try[], int cpt_try, char * date; date = ctime(&t); //stock the current time format as: day, month, number of the month, hour, year - FILE* fichier = fopen("save_party.txt", "w"); + FILE* fichier = fopen("save_party.txt", "a"); if (fichier != NULL) { fputs("Date and time: ", fichier); fputs(date,fichier); - fputs("\n",fichier); fputs("Status: ", fichier); fputs(status,fichier); @@ -81,6 +80,7 @@ void save_party(char * status, const char * good_word, char try[], int cpt_try, fputc(good_try[i],fichier); } fputs("\n",fichier); + fputs("\n",fichier); fclose(fichier); // Close the opened file } diff --git a/save_party.txt b/save_party.txt index 2b1f258..34861e2 100644 --- a/save_party.txt +++ b/save_party.txt @@ -1,6 +1,12 @@ -Date and time: Fri Oct 25 18:32:50 2024 - -Status: Win +Date and time: Fri Oct 25 22:29:13 2024 +Status: Lose Good word: koala -tried letters: sf -guessed letters: akol +tried letters: zertyu +guessed letters: a + +Date and time: Fri Oct 25 22:29:40 2024 +Status: Win +Good word: code +tried letters: a +guessed letters: code +