master
Lola CHALMIN 3 years ago
parent e596fbb7c0
commit 53174099c1

@ -6,3 +6,9 @@ void fRecherche(int *tNoClient, int n, int noClient, int *coderet, int *rang);
void fAffichage1Client(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, char *tStatut, int n, int noClient );
int afficheTous(int *tNoClient, char *tNomClient, char *tPreClient, int *tAge, char *tStatut, int n, int noClient )
//.h Lo
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);
char Card(void);//check si le client a la carte
void Name( char *nom, char *prenom);
void scanNandP(char *nom, char *prenom);

@ -1 +1,64 @@
//main commun
//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;
}

BIN
testlo

Binary file not shown.
Loading…
Cancel
Save