From 3d34654bd37a92ada9d58d32cd7d49411d735762 Mon Sep 17 00:00:00 2001 From: Roxane ROSSETTO Date: Tue, 8 Nov 2022 18:24:09 +0100 Subject: [PATCH] oublie lors du dernier commit : modif fichier perso et changement du nom de fichier main en commun --- fRox.c | 44 ++++-------------------------------- maincommun.c | 64 ---------------------------------------------------- 2 files changed, 4 insertions(+), 104 deletions(-) delete mode 100644 maincommun.c diff --git a/fRox.c b/fRox.c index 8fb6234..4491df7 100644 --- a/fRox.c +++ b/fRox.c @@ -3,46 +3,6 @@ -//Fonction de chargement depuis le dossier client. Return 0 si dossier introuvable ou tableau plein, return i nombre d'éléments chargés -int fchargement(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, int *tCActiv, int *tActivite, int *tPasseouPas,int *tPtsBought, int *tPtsBonus, char *tCat, int tmax) -{ - int noC, age, carte, activite, passage, ptsA, ptsB, i=0; - char prenom, nom, categorie; - FILE *fe; - - fe = fopen ("donneeClient.don", "r"); - if (fe == NULL) - { - printf("Le fichier est introuvable\n"); - return 0; - - fscanf(fe,"%d%c%c%d%d%d%d%d%c", &noC, &nom, &prenom, &age, &carte, &activite, &passage, &ptsA, &ptsB, &categorie); - - while(!feof(fe)) - { - if (i == tmax) - { - printf("Les tableaux sont pleins"); - return 0; - } - - tNoClient[i] = noC; - tNomClient[i] = nom; - tPreClient[i] = prenom; - tAge[i] = age; - tCat[i] = categorie; - tCActiv[i] = carte; - tActivite[i] = activite; - tPasseouPas[i] = passage; - tPtsBought[i] = ptsA; - tPtsBonus[i] = ptsB; - i++; - fscanf(fe,"%d%c%c%d%d%d%d%d%c", &noC, &nom, &prenom, &age, &carte, &activite, &passage, &ptsA, &ptsB, &categorie); - } - } - fclose(fe); - return i; -} //Fonction recherche, (*coderet = 1 si trouvé, = 0 si pas trouvé.) (*rang = rang a laquel se trouve ou doit se trouver la valeur) @@ -107,3 +67,7 @@ int afficheTous(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, c } } +int nbmEntree() +{ + +} \ No newline at end of file diff --git a/maincommun.c b/maincommun.c deleted file mode 100644 index e3882ac..0000000 --- a/maincommun.c +++ /dev/null @@ -1,64 +0,0 @@ -//main commun -#include "hCommun.h" - -int Fillvar(int *tAd, char tnom[][15], char tpnom[][15], int *tage, int *tstate, int *tacti, int *tpasseoupas, int *tptsbought, int *tptsbonus, char *tcateg, int tmax)//lis le fichier et met les valeurs dans les tableaux -{ - FILE *f; - f = fopen("donneeClient.don", "r"); - if (f == NULL) - { - printf("Problème d'ouverture du fichier Clients..."); - return -1; - } - int i = 0; - int numAd, age, state, acti, passeoupas, ptsbought, ptsbonus; - char categ, fnom[15], fprenom[15]; - - fscanf(f, "%6d", &numAd); - fscanf(f, "%s", fnom); - fscanf(f, "%s", fprenom); - fscanf(f, "%2d", &age); - fscanf(f, "%d", &state); - fscanf(f, "%d", &acti); - fscanf(f, "%d", &passeoupas); - fscanf(f, "%2d", &ptsbought); - fscanf(f, "%2d%*c", &ptsbonus); - fscanf(f, "%c", &categ); - - while (!feof(f)) - { - if (i == tmax) - { - printf("Problème de gestion: trop de clients enregistrés à ce jour"); - return -1; - } - - - tAd[i] = numAd; - strcpy(tnom[i], fnom); - strcpy(tpnom[i], fprenom); - tage[i] = age; - tstate[i] = state; - tacti[i] = acti; - tpasseoupas[i] = passeoupas; - tptsbought[i] = ptsbought; - tptsbonus[i] = ptsbonus; - tcateg[i] = categ; - - i++; - - fscanf(f, "%6d", &numAd); - fscanf(f, "%s", fnom); - fscanf(f, "%s", fprenom); - fscanf(f, "%2d", &age); - fscanf(f, "%d", &state); - fscanf(f, "%d", &acti); - fscanf(f, "%d", &passeoupas); - fscanf(f, "%2d", &ptsbought); - fscanf(f, "%2d%*c", &ptsbonus); - fscanf(f, "%c", &categ); - - } - fclose(f); - return 0; -} \ No newline at end of file