From f015f76cb0bdf75519a3d67bd84509d5d4cefd55 Mon Sep 17 00:00:00 2001 From: "jade.van_brabandt" Date: Tue, 10 Jan 2023 11:57:55 +0100 Subject: [PATCH] Sauvegarde Candidature --- src/partie2/saeP2.c | 16 ++++++++++++++++ src/partie2/saeP2.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/partie2/saeP2.c b/src/partie2/saeP2.c index 78d894a..0758320 100644 --- a/src/partie2/saeP2.c +++ b/src/partie2/saeP2.c @@ -46,6 +46,22 @@ candidat* LoadCandid(void) return Tabcandidat; } +void SaveCandid(int nbcandidat,candidat *tcandidat) +{ +//J'ouvre le fichier + FILE* file; + if((file=fopen("candid.bin","wb"))==NULL) + { + perror("Erreur : "); + exit(1); + } +//J'écris le nombre d'étudiant que je rentres + fwrite(&nbcandidat,sizeof(int),1,file); +//J'écris tout mes étudiants + fwrite(tcandidat,sizeof(candidat),nbcandidat,file); + printf("Sauvegarde réussit"); +} + void RechercheCandidat(int ID, int nbcandidat,candidat *tcandidat) { for(int i=0;i