|
|
|
@ -80,18 +80,18 @@ Listchoixdept listchoixdeptvide(void){
|
|
|
|
|
|
|
|
|
|
Listchoixdept inserercarte(Listchoixdept c, FILE *fe){
|
|
|
|
|
Maillonchoix* cc;
|
|
|
|
|
cc = (Maillonchoix*)malloc(sizeof(Maillonchoix));
|
|
|
|
|
cc = (Maillonchoix*)malloc(sizeof(Maillonchoix*));
|
|
|
|
|
if(cc==NULL){printf("<! pb malloc in ajoutercarte !>\n");exit(1);}
|
|
|
|
|
fscanf(fe, "%s %s %d %d", cc->Ville, cc->dep, &cc->decision, &cc->validation);
|
|
|
|
|
cc->suivant=c;
|
|
|
|
|
return cc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Maillonchoix lireChoix(FILE *fe, int nbchoix){
|
|
|
|
|
Listchoixdept lireChoix(FILE *fe, int nbchoix){
|
|
|
|
|
int i=0;
|
|
|
|
|
int decision, validation;
|
|
|
|
|
char Ville[21], dep[21];
|
|
|
|
|
Maillonchoix c, temp;
|
|
|
|
|
Listchoixdept c, temp;
|
|
|
|
|
c = listchoixdeptvide();
|
|
|
|
|
for(i=0; i<nbchoix; i++){
|
|
|
|
|
c = inserercarte(c, fe);
|
|
|
|
@ -100,11 +100,10 @@ Maillonchoix lireChoix(FILE *fe, int nbchoix){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
listetuinfo lireEtu(FILE *fe){
|
|
|
|
|
|
|
|
|
|
listetuinfo b;
|
|
|
|
|
int i;
|
|
|
|
|
listetuinfo b;
|
|
|
|
|
fscanf(fe, "%d %s %s %d %d %d %d %d", &b.numeroetu, b.nometu, b.prenometu, &b.notes[0], &b.notes[1], &b.notes[2], &b.notes[3], &b.nbchoix);
|
|
|
|
|
b.lchoixdept = lireChoix(fe, b.nbchoix);
|
|
|
|
|
b.lchoixdept = lireChoix(fe, nbchoix);
|
|
|
|
|
return b;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -117,12 +116,12 @@ int chargeretudiant(char nomFich[], listetuinfo *tetu[], int tmax){
|
|
|
|
|
fe = fopen( nomFich, "r");
|
|
|
|
|
if(fe==NULL){printf("<! pb ouverture fichier in chargeretudiant !>\n");return-1;}
|
|
|
|
|
fscanf(fe, "%d", &nbetu);
|
|
|
|
|
while(!feof(fe)){
|
|
|
|
|
for(i=0; i<nbetu; i++){
|
|
|
|
|
if(i==tmax){printf("<! erreur fichier in chargeetudiant !>");fclose(fe);return-1;}
|
|
|
|
|
printf("bonjour");
|
|
|
|
|
//a = lireEtu(fe);
|
|
|
|
|
tetu[i] = (listetuinfo*)malloc(sizeof(listetuinfo));
|
|
|
|
|
if(tetu[i]==NULL){printf("<! pb malloc in chargeretudiant !>\n");fclose(fe);return-1;}
|
|
|
|
|
a = lireEtu(fe);
|
|
|
|
|
*tetu[i] = a;
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|