Louis GERMAIN 1 year ago
commit 98aa6faa23

@ -1,7 +1,45 @@
# SAE 1.01 - Implémentation d'un besoin client =====================================
SAÉ 1.01 - Implémentation d'un besoin client
=====================================
__1A - Groupe 7/8:__ Par:
- Rémi LAVERGNE Rémi LAVERGNE - Julien ABADIE - Louis GERMAIN
- Julien ABADIE Groupe 7/8 - 1A 2023-2024
- Louis GERMAIN
**Répartition du Travail**
-----------------------
Rémi LAVERGNE : /
Louis GERMAIN : /
Julien ABADIE : /
**Composition des fichiers sources**
--------------------------------
- *main.c* >> Juste la fonction main, se lançant lors de l'exécution du programme.
- *main.h* >> Tous les prototypes des fonctions réalisées, ainsi que les inclusions de module et déclaration de constantes.
- *articles.txt* >> Fichier texte composé de x colonnes,
- *clients.txt* >> Fichier texte composé de x colonnes dans l'ordre qui suit :
identifiant | mot de passe | cagnotte | suspendu (0=actif ; 1=suspendu) | rôle (0=client ; 1=administrateur)
**Fonctionnement**
------------
Jeu de données
==============
articles.txt
```
/
```
clients.txt
```
/
```

@ -48,7 +48,6 @@ int chargeArticles(int reference[], float weight[], float volume[], float unitPr
if(article==NULL) if(article==NULL)
{ {
errorHandling(-4); errorHandling(-4);
exit(1);
} }
int ref, tL=0; int ref, tL=0;
@ -98,8 +97,7 @@ int chargeClients(int clientID[], int clientPassword[], float cagnotte[], int su
client = fopen("clients.txt","r"); client = fopen("clients.txt","r");
if(client==NULL) if(client==NULL)
{ {
printf("ERREUR: Echec de l'ouverture en lecture de 'clients.txt'.\n"); errorHandling(-4);
exit(1);
} }
int id, passwd, sus, tL=0, adm; int id, passwd, sus, tL=0, adm;
@ -110,7 +108,7 @@ int chargeClients(int clientID[], int clientPassword[], float cagnotte[], int su
{ {
if(tL == tmaxArticles) if(tL == tmaxArticles)
{ {
printf("Tableau trop petit.\n"); errorHandling(-3);
return tL; return tL;
} }
@ -166,14 +164,10 @@ void sauvegardeArticles(int reference[], float weight[], float volume[], float u
article = fopen("articles.txt","w"); article = fopen("articles.txt","w");
if(article==NULL) if(article==NULL)
{ {
printf("ERREUR: Echec de l'ouverture en écriture de 'articles.txt'.\n"); errorHandling(-5);
exit(1);
} }
printf("ERREUR: Echec de l'ouverture en écriture de 'clients.txt'.\n");
int i; exit(1);%f\n", reference[i], weight[i], volume[i], unitPrice[i]);
for(i=0; i<tLogArticle; i++)
{
fprintf(article, "%d %f %f %f\n", reference[i], weight[i], volume[i], unitPrice[i]);
} }
fclose(article); fclose(article);
@ -196,8 +190,7 @@ void sauvegardeClients(int clientID[], int clientPassword[], float cagnotte[], i
client = fopen("clients.txt","w"); client = fopen("clients.txt","w");
if(client==NULL) if(client==NULL)
{ {
printf("ERREUR: Echec de l'ouverture en écriture de 'clients.txt'.\n"); errorHandling(-5);
exit(1);
} }
int i; int i;

Loading…
Cancel
Save