Correction du bug menu candidat qui causait une erreur de segmentation

master
Johnny RATTON 2 years ago
parent a7297befe6
commit 36d5c7b4fb

@ -1,4 +1,4 @@
#include "M2sae.h"
#include "Msae.h"
/*********************************************************** Fonctions de listes **************************************************************/
/**********************************************************************************************************************************************/
@ -194,7 +194,7 @@ void afficheDeptDesIUT(VilleIUT *tiut[], int tLog)
rechercherDept(tiut[i]->lDept,dept,&trouve);
if (trouve==1)
{
printf("|%s",tiut[i]->nom);
printf("* %s\n",tiut[i]->nom);
}
}
printf("|\n");
@ -592,7 +592,7 @@ int login(Candidat *tCand[],int *tMax,int *pos) /* Affiche un menu de connexion
int i = 3,trouve,numC;
char id, mdp[31] = "mettez20svp", mdpatrouve[31],choix; /* Déclaration d'un motdepasse administrateur */
system("clear");
printf("\t################################ Bienvenue! ################################\nSouhaitez-vous vous connecter en tant qu'utilisateur ou administeur ? (C/A)\nSaisie : ");
printf("\t################################ Bienvenue! ################################\nSouhaitez-vous vous connecter en tant que candidat, administeur ou responsable d'admissions ? (C/A/R)\nSaisie : ");
scanf("%c%*c",&id);
if(id == 'q') /* Si l'utilisateur saisie la lettre 'q', le programme s'arrête */
{
@ -601,7 +601,7 @@ int login(Candidat *tCand[],int *tMax,int *pos) /* Affiche un menu de connexion
while(id != 'A' && id != 'a' && id != 'C' && id != 'c') /* Effectue une saisie contrôlée si la saisie ne correspond à aucune option */
{
system("clear");
printf("\t#################### Mauvaise saisie ('q' pour quitter) ####################\nSouhaitez-vous vous connecter en tant qu'utilisateur ou administeur ou en tant que responsable? (C/A/R)\nSaisie : ");
printf("\t#################### Mauvaise saisie ('q' pour quitter) ####################\nSouhaitez-vous vous connecter en tant que candidat, administrateur ou responsable d'admissions ? (C/A/R)\nSaisie : ");
scanf("%c%*c",&id);
if(id == 'q')
{
@ -881,26 +881,26 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
{
if(select == 5)
{
for(i = 0; i < tCand[pos]->nombreChoix; i++)
for(i = 0; i < tCand[posC]->nombreChoix; i++)
{
afficherChoix(tCand[pos]->tChoix[i]);
afficherChoix(tCand[posC]->tChoix[i]);
}
}
if(select == 6)
{
tCand[pos]->tChoix = insererChoix(tCand[pos]->tChoix, &tCand[pos]->nombreChoix);
for(i = 0; i < tCand[pos]->nombreChoix; i++)
tCand[posC]->tChoix = insererChoix(tCand[posC]->tChoix, &tCand[posC]->nombreChoix);
for(i = 0; i < tCand[posC]->nombreChoix; i++)
{
afficherChoix(tCand[pos]->tChoix[i]);
afficherChoix(tCand[posC]->tChoix[i]);
}
clearpage();
}
if(select == 7)
{
tCand[pos]->tChoix = supprimerChoix(tCand[pos]->tChoix, &tCand[pos]->nombreChoix);
for(i = 0; i < tCand[pos]->nombreChoix; i++)
tCand[posC]->tChoix = supprimerChoix(tCand[posC]->tChoix, &tCand[posC]->nombreChoix);
for(i = 0; i < tCand[posC]->nombreChoix; i++)
{
afficherChoix(tCand[pos]->tChoix[i]);
afficherChoix(tCand[posC]->tChoix[i]);
}
clearpage();
}
@ -916,7 +916,7 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
}
else
{
retour=miseAJourChoixCand(tCand[pos]->tChoix, tCand[pos]->nombreChoix);
retour=miseAJourChoixCand(tCand[posC]->tChoix, tCand[posC]->nombreChoix);
if (retour==-2 || retour==0)
{
printf("Vos choix n'ont pas été mis à jour.\n");
@ -924,11 +924,11 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
}
if (retour==1)
{
while(j<tCand[pos]->nombreChoix)
while(j<tCand[posC]->nombreChoix)
{
if (tCand[pos]->tChoix[j]->decisionCand!=1)
if (tCand[posC]->tChoix[j]->decisionCand!=1)
{
tCand[pos]->tChoix[j]->decisionCand=-1;
tCand[posC]->tChoix[j]->decisionCand=-1;
j++;
}
@ -937,16 +937,16 @@ void menuCandidat(VilleIUT *tiut[], int *tLog, int tMax,Candidat *tCand[],int tM
}
if(retour==-1)
{
while (j<tCand[pos]->nombreChoix)
while (j<tCand[posC]->nombreChoix)
{
if(strcmp(tCand[pos]->tChoix[j]->ville, "Clermont-Ferrand") == 0 && strcmp(tCand[pos]->tChoix[j]->dep, "Informatique") == 0)
if(strcmp(tCand[posC]->tChoix[j]->ville, "Clermont-Ferrand") == 0 && strcmp(tCand[posC]->tChoix[j]->dep, "Informatique") == 0)
{
tCand[pos]->tChoix[j]->decisionCand=-1;
tCand[posC]->tChoix[j]->decisionCand=-1;
break;
}
}
suppr=rechercherCandListe(*ladmis,tCand[pos]->numeroC,&trouve);
*ladmis=supprimerCand(*ladmis,tCand[pos]);
suppr=rechercherCandListe(*ladmis,tCand[posC]->numeroC,&trouve);
*ladmis=supprimerCand(*ladmis,tCand[posC]);
*f=fileToAdmis(*f,ladmis,1,mini);
}
}
@ -1144,6 +1144,7 @@ void globale(void) /* Permet l'initialisation du tableau, le chargement de celui
retour = login(tCand,&tMax,&pos); /* Appelle la fonction login */
while(retour != -1) /* Tant que login ne retourne pas -1, la fonction appelle le menu adaptée en fonction du retour de login puis appelle de nouveau login */
{
afficherCandChoix(tCand, tMax);
if(retour == 1)
{
menuAdmin(tiut, &tLog, 100,tCand,tMax,&phaseCandidature,&f,&ladmis);

Loading…
Cancel
Save