From 4dba409b95af37f8ae070dc59e8ab9a110f04175 Mon Sep 17 00:00:00 2001 From: d3friski Date: Fri, 6 Jan 2023 14:48:20 +0100 Subject: [PATCH] =?UTF-8?q?correction=20de=20bug=20fonction=20de=20chargem?= =?UTF-8?q?ent=20o=C3=B9=20l'on=20ajoutait=201=20au=20nombre=20de=20ville?= =?UTF-8?q?=20m=C3=AAme=20si=20elle=20existait=20d=C3=A9j=C3=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/chargEtSauvFich.c | 2 +- source/test.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/chargEtSauvFich.c b/source/chargEtSauvFich.c index bebde0d..97ee55a 100644 --- a/source/chargEtSauvFich.c +++ b/source/chargEtSauvFich.c @@ -34,10 +34,10 @@ int chargIutDon(VilleIut *tVilleIut[], int nbMax, char nomFich[]) strcpy(tVilleIut[i]->nom, nom); tVilleIut[i]->ldept = listenouv(); ajouterDept(tVilleIut[i]->ldept, nomDept, resp, nbP); + i = i + 1; } if(trouve==1) ajouterDept(tVilleIut[indice]->ldept, nomDept, resp, nbP); - i = i + 1; fscanf(flot, "%s", nom); lireDep(flot, nomDept, &nbP, resp); } diff --git a/source/test.c b/source/test.c index 69b589f..30be4f0 100644 --- a/source/test.c +++ b/source/test.c @@ -8,11 +8,11 @@ void testJean(void) { int nbvilles; - VilleIut **tIut ; + VilleIut *tIut[50] ; - nbvilles= chargIutDon(tIut, 50, "iut.don"); + nbvilles= chargIutDon(tIut, 50, "../donnees/iut.don"); - tIut = (VilleIut **)malloc(sizeof(VilleIut *)*nbvilles); + //tIut = (VilleIut **)malloc(sizeof(VilleIut *)*nbvilles); // strcpy(tIut[0]->nom, "John"); // strcpy(tIut[0]->ldept->nomDept, "Info"); // strcpy(tIut[0]->ldept->resp, "YAnis");