From 4e6a1b8f407ca69fc1049e479331f4b0f8adcfa8 Mon Sep 17 00:00:00 2001 From: Alix JEUDI--LEMOINE Date: Fri, 13 Jan 2023 14:04:46 +0100 Subject: [PATCH] =?UTF-8?q?D=C3=A9placement=20de=20readStatus=20&=20saveSt?= =?UTF-8?q?atus=20depuis=20la=20partie=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/II/deux.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/II/deux.c b/src/II/deux.c index 2167f50..5dbebc7 100644 --- a/src/II/deux.c +++ b/src/II/deux.c @@ -360,4 +360,34 @@ int saveCandidats(ListeCandidats liste, int nbCandidats) { fclose(fe); return 0; +} + +int readStatus(void) { + int status; + + FILE *fe = fopen("donnees/status.don", "r"); + + if(fe == NULL) { + perror("fopen"); + exit(errno); + } + + fscanf(fe, "%d", &status); + + fclose(fe); + + return status; +} + +void saveStatus(int status) { + FILE *fe = fopen("donnees/status.don", "w"); + + if(fe == NULL) { + perror("fopen"); + exit(errno); + } + + fprintf(fe, "%d", status); + + fclose(fe); } \ No newline at end of file