fct chargement, test

master
Roxane ROSSETTO 2 years ago
parent 8669fa946b
commit ab12d872d0

@ -273,10 +273,37 @@ Filecand ChargementfileC(Filecand fC, int *nbC)//chargement du fichier dans cett
return fC; return fC;
} }
int chargement (Candidat tCandAcc[], int tmax, FILEfe){// chargement des files cand et chx
fscanf( fe, "%d", nbCand );
c = lireCa (fe);
while ( !feof(fe) ){
if ( i == tmax){
printf("La liste des candidats admis est complète\n");
return 0;
}
tCandAcc[i] = (Candidat *) malloc (sizeof(Candidat));
if (tCandAcc[i] == NULL ){
printf("Problème malloc\n");
return -1;
}
*tCandAcc[i] = c;
fscanf( fe, "%d", &nbC);
tCandAcc[i]->lchx = Chargementlistecandidat ( fe, tCandAcc[i]->lchx, nbC);
i++;
c = lireCa (fe);
}
fclose (fe);
return i;
}
void test (void){ void test (void){
FILE *fe; FILE *fe;
int menu1, tlog;
CandidattCand[120];
fe = fopen( "part4.don", "r"); fe = fopen( "part4.don", "r");
if ( fe == NULL ){ if ( fe == NULL ){
@ -288,5 +315,20 @@ void test (void){
fC = initcand(); fC = initcand();
fC = ChargementfileC(fC, &nbC); fC = ChargementfileC(fC, &nbC);
tlog = chargement (tCand, 120, fe);
Afftab(tCand, tlog);
/*
printf("Etes-vous un candidat(1) ou un responsable(2)?\n");
scanf("%d", &menu1);
while( menu1 == 1 || menu1 == 2 ){
if ( menu1 == 1 ){
} }
}
*/
}

@ -52,6 +52,7 @@ Filecand enfC(Filecand fC, Candidat c);
Filechx enf(Filechx fchx, Choix c); Filechx enf(Filechx fchx, Choix c);
Choix def(Filechx fc); Choix def(Filechx fc);
Candidat defC(Filecand fC); Candidat defC(Filecand fC);
int chargement (Candidat tCandAcc[], int tmax, FILEfe);// chargement des files cand et chx
void test (void); void test (void);

Loading…
Cancel
Save