|
|
|
@ -15,6 +15,31 @@ void chargeArticles(int reference[], float weight[], float volume[], float unitP
|
|
|
|
|
printf("ERREUR: Echec de l'ouverture en lecture de 'articles.txt'.\n");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ref, tL=0;
|
|
|
|
|
float w, v, up;
|
|
|
|
|
|
|
|
|
|
fscanf(article, "%d %f %f %f", &ref, &w, &v, &up);
|
|
|
|
|
while(!feof(article))
|
|
|
|
|
{
|
|
|
|
|
if(tL < tmaxArticles)
|
|
|
|
|
{
|
|
|
|
|
printf("Tableau trop petit.\n");
|
|
|
|
|
return tL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reference[tL] = ref;
|
|
|
|
|
weight[tL] = w;
|
|
|
|
|
volume[tL] = v;
|
|
|
|
|
unitPrice[tL] = up;
|
|
|
|
|
|
|
|
|
|
tL++;
|
|
|
|
|
|
|
|
|
|
fscanf(article, "%d %f %f %f", &ref, &w, &v, &up);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(article);
|
|
|
|
|
return tL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void chargeClients(int clientID[], float cagnotte[], int suspended[])
|
|
|
|
@ -26,9 +51,34 @@ void chargeClients(int clientID[], float cagnotte[], int suspended[])
|
|
|
|
|
printf("ERREUR: Echec de l'ouverture en lecture de 'clients.txt'.\n");
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int id, sus, tL=0;
|
|
|
|
|
float cag;
|
|
|
|
|
|
|
|
|
|
fscanf(client, "%d %f %d", &id, &cag, &sus);
|
|
|
|
|
while(!feof(client))
|
|
|
|
|
{
|
|
|
|
|
if(tL < tmaxArticles)
|
|
|
|
|
{
|
|
|
|
|
printf("Tableau trop petit.\n");
|
|
|
|
|
return tL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
clientID[tL] = id;
|
|
|
|
|
cagnotte[tL] = cag;
|
|
|
|
|
suspended[tL] = sus;
|
|
|
|
|
|
|
|
|
|
tL++;
|
|
|
|
|
|
|
|
|
|
fscanf(client, "%d %f %d", &id, &cag, &sus);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(client);
|
|
|
|
|
return tL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void sauvegardeDonnees()
|
|
|
|
|
void sauvegardeDonnees(int reference[], float weight[], float volume[], float unitPrice[], int clientID[], float cagnotte[], int suspended[])
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
sauvegardeArticles(reference, weight, volume, unitPrice);
|
|
|
|
|
sauvegardeClients(clientID, cagnotte, suspended);
|
|
|
|
|
}
|