diff --git a/part4.c b/part4.c index c0eb9f7..bd6a176 100644 --- a/part4.c +++ b/part4.c @@ -33,16 +33,15 @@ Candidat lireCa(FILE *fe)// lit un candidat dans un fichier { Candidat c;//candidat que l'on retournera int cpt;//pour la création de maillons - fscanf(fe,"%*c%d", &c.nEtu); - fscanf(fe, "%s", c.nom); - - fscanf(fe, "%s", c.prenom); - //fgets(c.prenom, 27, fe); - //c.prenom[strlen(c.prenom)-1]= '\0'; - printf("%s\n", c.prenom); - fscanf(fe, "%f %f %f %f", &c.moymat, &c.moyfr, &c.moyen, &c.moyspe); + fscanf(fe,"%d", &c.nEtu); + fscanf(fe, "%s%*c", c.nom); + + fgets(c.prenom, 27, fe); + c.prenom[strlen(c.prenom)-1]= '\0'; + + fscanf(fe, "%f %f %f %f %f", &c.moymat, &c.moyfr, &c.moyen, &c.moyspe, &c.noteDoss); + fscanf(fe, "%d", &c.nbchx); - printf("%d", c.nbchx); c.fchx = initchx();//initialisation de la file for (cpt = 0; cpt < c.nbchx; cpt++) { @@ -151,6 +150,42 @@ Filecand enfC(Filecand fC, Candidat c) } +Choix def(Filechx fc) +{ + Maillonchx *tmp; + + if (testVideChx){printf("file vide impossible de défiler\n");exit(-1);} + else + { + Choix c; + c = fc.ttchx->chx;//on met le choix de la file dans le choix à retourner + tmp = fc.ttchx->suivchx;//on crée le maillon temporaire qui prend la valeur du suivant + free(fc.ttchx);//on free celui qui doit être défilé + fc.ttchx=tmp;//on remet la file comme il faut + return c; + } +} + + +Candidat defC(Filecand fC)//même version mais avec un candidat +{ + Mailloncand *tmp; + + if (testVideCand){printf("file vide impossible de défiler\n");exit(-1);} + else + { + Candidat c; + c = fC.ttcand->cand; + tmp = fC.ttcand->suivcand; + free(fC.ttcand); + fC.ttcand = tmp; + return c; + } +} + + + + /* // FAIRE LECTURE CANDIDAT POUR METTRE EN PARALLELE @@ -227,11 +262,9 @@ Filecand ChargementfileC(Filecand fC, int *nbC)//chargement du fichier dans cett int cpt; fe = fopen("part4.don", "r"); if (fe == NULL){printf("pb ouv part4.don\n"); exit(-1);} - printf("ollow\n"); fscanf(fe, "%d", nbC); for (cpt = 0; cpt < *nbC; cpt ++) { - puts("here"); Candidat c; c = lireCa(fe); fC = enfC(fC, c); @@ -252,11 +285,8 @@ void test (void){ } Filecand fC; int nbC; - printf("bon\n"); fC = initcand(); - printf("jour\n"); fC = ChargementfileC(fC, &nbC); - }