oublie lors du dernier commit : modif fichier perso et changement du nom de fichier main en commun

master
Roxane ROSSETTO 2 years ago
parent ec68914001
commit 3d34654bd3

@ -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()
{
}

@ -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;
}
Loading…
Cancel
Save