From 4e5e28e3c5abd4ef7577adbead04d40fa839e1c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20LAVERGNE?= Date: Tue, 7 Nov 2023 16:06:50 +0100 Subject: [PATCH] Modification des codes d'erreur --- src/debug.c | 22 ---------------------- src/errorHandling.c | 21 +++++---------------- src/main.h | 2 -- 3 files changed, 5 insertions(+), 40 deletions(-) diff --git a/src/debug.c b/src/debug.c index 15bd1d6..6a0cb58 100644 --- a/src/debug.c +++ b/src/debug.c @@ -5,26 +5,6 @@ #include "main.h" -void displayItemListDEBUG(int reference[], float weight[], float volume[], float unitPrice[], int log) -{ - int i; - printf("DEBUG - Affichage des articles: \n"); - for (i = 0; i < log; i++) - { - printf("Référence: %d, Poids: %f, Volume: %f, Prix unitaire: %f\n", reference[i], weight[i], volume[i], unitPrice[i]); - } -} - -void displayClientListDEBUG(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int log) -{ - int i; - printf("DEBUG - Affichage des clients: \n"); - for (i = 0; i < log; i++) - { - printf("Identifiant: %d, Cagnotte: %f, Suspendu: %d, Admin: %d\n", clientID[i], cagnotte[i], suspended[i], isAdmin[i]); - } -} - void debugMenu(int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tlogArticle, int tlogClient) { int choice; @@ -37,10 +17,8 @@ void debugMenu(int tabReference[], float tabWeight[], float tabVolume[], float u switch (choice) { case 1: - displayItemListDEBUG(tabReference, tabWeight, tabVolume, unitPrice, tlogArticle); break; case 2: - displayClientListDEBUG(clientID, cagnotte, suspended, isAdmin, tlogClient); break; default: break; diff --git a/src/errorHandling.c b/src/errorHandling.c index c739a42..1020908 100644 --- a/src/errorHandling.c +++ b/src/errorHandling.c @@ -15,6 +15,7 @@ void errorHandling(int error) //? Exemple d'erreurs (à adapter) if (error < 0) { + printf("\a"); // Bip d'erreur switch (error) { case -1: @@ -24,30 +25,18 @@ void errorHandling(int error) printf("[ERREUR] - La taille physique du tableau est dépassée.\n"); break; case -3: - printf("[ERREUR] - L'identifiant doit être positif.\n"); + print("ERREUR] - Problème lors de la lecture d'un fichier.\n"); break; case -4: - printf("[ERREUR] - L'identifiant n'existe pas.\n"); + printf("[ERREUR] - Problème lors de l'écriture d'un fichier.\n"); break; case -5: - printf("[ERREUR] - Le poids doit être positif.\n"); + printf("[ERREUR] - Le champ renseigné doit être positif.\n"); break; case -6: - printf("[ERREUR] - Le volume doit être positif.\n"); + printf("[ERREUR] - L'identifiant n'existe pas.\n"); break; case -7: - printf("[ERREUR] - Le prix unitaire doit être positif.\n"); - break; - case -8: - printf("[ERREUR] - La quantité doit être positive.\n"); - break; - case -9: - printf("[ERREUR] - La référence doit être positive.\n"); - break; - case -10: - printf("[ERREUR] - La référence n'existe pas.\n"); - break; - case -11: printf("[ERREUR] - La référence existe déjà.\n"); break; default: diff --git a/src/main.h b/src/main.h index 2ecbdeb..0e69b01 100644 --- a/src/main.h +++ b/src/main.h @@ -16,8 +16,6 @@ void errorHandling(int error); void debugHandling(int code); //! DEBUG -void displayItemListDEBUG(int reference[], float weight[], float volume[], float unitPrice[], int log); -void displayClientListDEBUG(int clientID[], float cagnotte[], int suspended[], int isAdmin[], int log); void debugMenu(int tabReference[], float tabWeight[], float tabVolume[], float unitPrice[], int clientID[], float cagnotte[], int suspended[], int isAdmin[], int tlogArticle, int tlogClient); //! TRAITEMENT DES FICHIERS