Ajouts de thread + modifications
This commit is contained in:
@@ -10,6 +10,13 @@
|
||||
#define MAX_NAME_LEN 10
|
||||
#define FILENAME "../Data/accounts.db"
|
||||
|
||||
// Couleurs pour l'affichage
|
||||
#define RESET "\033[0m"
|
||||
#define GREEN "\033[32m"
|
||||
#define RED "\033[31m"
|
||||
#define PINK "\033[35m"
|
||||
#define BLUE "\033[34m"
|
||||
|
||||
// Fonction pour lire un compte dans le fichier avec verrouillage
|
||||
void read_account(int fd, int index, char *name, int *balance) {
|
||||
char buffer[ACCOUNT_SIZE];
|
||||
@@ -64,9 +71,9 @@ void perform_transaction(int fd, int account_count) {
|
||||
write_account(fd, from_idx, from_name, from_balance);
|
||||
write_account(fd, to_idx, to_name, to_balance);
|
||||
|
||||
printf("Transaction : %s -> %s : %d€\n", from_name, to_name, transfer_amount);
|
||||
printf(GREEN "Transaction : %s -> %s : %d€\n" RESET, from_name, to_name, transfer_amount);
|
||||
} else {
|
||||
printf("Transaction annulée : Fonds insufisants %s\n", from_name);
|
||||
printf(RED "Transaction annulée : Fonds insufisants %s\n" RESET, from_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user