diff --git a/IUT.don b/IUT.don new file mode 100644 index 0000000..08306c5 --- /dev/null +++ b/IUT.don @@ -0,0 +1,4 @@ +Grenoble Informatique 112 Dupont Jean +Clermont-Ferrand Informatique 136 Simon Carine +Aurillac Bio-Informatique 56 Dufour Martine +Clermont-Ferrand Biologie 120 Montier Benoît diff --git a/Jsae.c b/Jsae.c index a5e598e..13cdaae 100644 --- a/Jsae.c +++ b/Jsae.c @@ -11,6 +11,7 @@ int chargement(VilleIUT *tiut[],int *tMax) if(flot == NULL) { printf("Problème d'ouverture du fichier\n"); + fclose(flot); return -1; } while(!feof(flot)) @@ -19,14 +20,16 @@ int chargement(VilleIUT *tiut[],int *tMax) if(v == NULL) { printf("Problème allocation ville lors de la lecture du fichier\n"); + fclose(flot); return -2; } fscanf(flot, "%s", v->nom); - pos = recherche(tiut, nb, v->nom, &trouve); + pos = rechercheIUT(tiut, nb, v->nom, &trouve); m = (MaillonDept *)malloc(sizeof(MaillonDept)); if(m == NULL) { printf("Problème allocation département lors de la lecture du fichier\n"); + fclose(flot); return -3; } *m = lireDep(flot); @@ -58,12 +61,12 @@ MaillonDept lireDep(FILE *flot) void afficherDep(MaillonDept m) { - printf("%s\t%d\t%s\n", m.dept, m.nbP, m.respAd); + printf("\t%s\t%d\t%s\n", m.dept, m.nbP, m.respAd); } void afficherVille(VilleIUT v) { - printf("%s\t", v.nom); + printf("%s", v.nom); while(v.lDept != NULL) { afficherDep(*v.lDept); @@ -71,6 +74,14 @@ void afficherVille(VilleIUT v) } } +void afficherTIUT(VilleIUT *tiut[], int tLog) +{ + int i = 0; + for(i = 0; i < tLog; i++) + { + afficherVille(*(tiut[i])); + } +} void globale(void) {