From 5859d9606d9323a40b360a3d07508dff04f9a43b Mon Sep 17 00:00:00 2001 From: "Johnny.Ratton" Date: Thu, 15 Dec 2022 11:32:54 +0100 Subject: [PATCH] =?UTF-8?q?Cr=C3=A9ation=20du=20fichier=20IUT.don=20et=20f?= =?UTF-8?q?onction=20afficherTIUT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IUT.don | 4 ++++ Jsae.c | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 IUT.don 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) {