master
parent
ec68914001
commit
3d34654bd3
@ -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…
Reference in new issue