From eb1afcb2b7d9097e1f9f9d3de540448e259a8e7a Mon Sep 17 00:00:00 2001 From: "yann.champeau" Date: Fri, 13 Jan 2023 18:18:37 +0100 Subject: [PATCH 1/6] Ajustements. --- src/partie2/saeP2.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/partie2/saeP2.c b/src/partie2/saeP2.c index ca25d3f..406f094 100644 --- a/src/partie2/saeP2.c +++ b/src/partie2/saeP2.c @@ -5,7 +5,7 @@ #include "../partie1/saeP1.h" #include "../annexe/saeAnnexe.h" -candidat* LoadCandid(int* CandidOpen, int* nbcandid) +candidat** LoadCandid(int* CandidOpen, int* nbcandid) { //J'ouvre le fichier FILE* file; @@ -17,18 +17,18 @@ candidat* LoadCandid(int* CandidOpen, int* nbcandid) fread(CandidOpen,sizeof(int),1,file); //Lire la première ligne pr savoir combien d'étudiant je vais lire fread(nbcandid,sizeof(int),1,file); - candidat* Tabcandidat=(candidat*) malloc (sizeof(candidat)*(*nbcandid)); + candidat** Tabcandidat=(candidat**) malloc (sizeof(candidat*)*(*nbcandid)); //Tant que j'ai des étudiants à lire : for(int i=0;*nbcandid>i;++i) { //Son numéro, Son nom, Son prenom, liste de note` - candidat Candidat_ajout; - fread(&Candidat_ajout.numcandid,sizeof(int),1,file); - fread(Candidat_ajout.surname,sizeof(char)*31,1,file); - fread(Candidat_ajout.name,sizeof(char)*31,1,file); - fread(Candidat_ajout.note,sizeof(float)*4,1,file); + Tabcandidat[i]=(candidat*)malloc(sizeof(candidat)); + fread(&Tabcandidat[i]->numcandid,sizeof(int),1,file); + fread(Tabcandidat[i]->surname,sizeof(char)*31,1,file); + fread(Tabcandidat[i]->name,sizeof(char)*31,1,file); + fread(Tabcandidat[i]->note,sizeof(float)*4,1,file); //Son nb de choix - fread(&Candidat_ajout.nbchoix,sizeof(int),1,file); + fread(&Tabcandidat[i]->nbchoix,sizeof(int),1,file); //Tant que j'ai pas fait tout ces choix : for(int y=0;yvcand,sizeof(int),1,file); Candidat_ajout.TabVoeu[i]=voeu_ajout; } - Tabcandidat[i]=Candidat_ajout; } //Je sors return Tabcandidat; From 7bace37dafe0d072409428e0c9677d19f663adf9 Mon Sep 17 00:00:00 2001 From: "yann.champeau" Date: Fri, 13 Jan 2023 18:24:18 +0100 Subject: [PATCH 2/6] Ajustements. --- src/partie1/saeP1.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/partie1/saeP1.c b/src/partie1/saeP1.c index 0107d8d..97f4e2e 100644 --- a/src/partie1/saeP1.c +++ b/src/partie1/saeP1.c @@ -355,10 +355,8 @@ void modifNomResponsable(VilleIUT* tiut[],int tlogi){ MaillonDep* m=v->ldept; while(m->departement!=dep) m=m->suivant; printf("\n\nLe responsable du département %s de l'IUT de la ville de %s est actuellement %s. Quel est le nom du nouveau responsable ?\n\n",m->departement,v->Ville,m->resp); - char nom[51]; scanf("%*c"); - fgets(m->nom, 51, stdin); - strcpy(m->resp,nom); + fgets(m->resp, 51, stdin); printf("\n\nLe nom du responsable du département %s de l'IUT de %s a bien été changé pour %s.\n",dep,ville,nom); return; } From 44f6f18ff60bc936b3222e74fa667899b4b06d4b Mon Sep 17 00:00:00 2001 From: "yann.champeau" Date: Fri, 13 Jan 2023 18:26:32 +0100 Subject: [PATCH 3/6] Ajustements. --- src/partie1/saeP1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/partie1/saeP1.c b/src/partie1/saeP1.c index 97f4e2e..fb7fa51 100644 --- a/src/partie1/saeP1.c +++ b/src/partie1/saeP1.c @@ -357,7 +357,7 @@ void modifNomResponsable(VilleIUT* tiut[],int tlogi){ printf("\n\nLe responsable du département %s de l'IUT de la ville de %s est actuellement %s. Quel est le nom du nouveau responsable ?\n\n",m->departement,v->Ville,m->resp); scanf("%*c"); fgets(m->resp, 51, stdin); - printf("\n\nLe nom du responsable du département %s de l'IUT de %s a bien été changé pour %s.\n",dep,ville,nom); + printf("\n\nLe nom du responsable du département %s de l'IUT de %s a bien été changé pour %s.\n",dep,ville,m->resp); return; } From a87d17a27e0fe7a8a19d49d076cb5e25bda5ec43 Mon Sep 17 00:00:00 2001 From: "yann.champeau" Date: Fri, 13 Jan 2023 18:28:16 +0100 Subject: [PATCH 4/6] Ajustements. --- src/partie2/saeP2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/partie2/saeP2.c b/src/partie2/saeP2.c index 406f094..fc26664 100644 --- a/src/partie2/saeP2.c +++ b/src/partie2/saeP2.c @@ -30,7 +30,7 @@ candidat** LoadCandid(int* CandidOpen, int* nbcandid) //Son nb de choix fread(&Tabcandidat[i]->nbchoix,sizeof(int),1,file); //Tant que j'ai pas fait tout ces choix : - for(int y=0;ynbchoix;++y) { //Je lis La ville, le département, la décision du dep, la validation du candidat voeu* voeu_ajout=(voeu*)malloc(sizeof(voeu)); From 93d651325d4541cb686a62363f6c260a7c368c9b Mon Sep 17 00:00:00 2001 From: "yann.champeau" Date: Fri, 13 Jan 2023 18:29:42 +0100 Subject: [PATCH 5/6] Ajustements. --- src/partie2/saeP2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/partie2/saeP2.c b/src/partie2/saeP2.c index fc26664..36e8c70 100644 --- a/src/partie2/saeP2.c +++ b/src/partie2/saeP2.c @@ -38,7 +38,7 @@ candidat** LoadCandid(int* CandidOpen, int* nbcandid) fread(voeu_ajout->dep,sizeof(char)*31,1,file); fread(&voeu_ajout->ddep,sizeof(int),1,file); fread(&voeu_ajout->vcand,sizeof(int),1,file); - Candidat_ajout.TabVoeu[i]=voeu_ajout; + Tabcandidat[i]->TabVoeu[i]=voeu_ajout; } } //Je sors From da8959d8187245a4936b43313912f8612d7dbc3f Mon Sep 17 00:00:00 2001 From: "yann.champeau" Date: Fri, 13 Jan 2023 18:40:08 +0100 Subject: [PATCH 6/6] Ajustements. --- src/partie1/saeP1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/partie1/saeP1.c b/src/partie1/saeP1.c index fb7fa51..4862e85 100644 --- a/src/partie1/saeP1.c +++ b/src/partie1/saeP1.c @@ -347,7 +347,7 @@ void modifNomResponsable(VilleIUT* tiut[],int tlogi){ VilleIUT* v=tiut[noVille]; printf("\n\nEntrez le département à modifier:"); char dep[31]; - scanf("%s",dep); + scanf("%*c%s",dep); if(!existeDep(v->ldept,dep)){ fprintf(stderr,"\nDépartement non existant !\n"); return;