diff --git a/src/currentCustomerAccountBalance.c b/src/currentCustomerAccountBalance.c index 9d2e365..9f415f9 100644 --- a/src/currentCustomerAccountBalance.c +++ b/src/currentCustomerAccountBalance.c @@ -25,10 +25,9 @@ float readFileAndGetAvailableBalance(FILE *file, char stringID[MAX_LENGTH]) { keep_reading = false; } else if(strstr(buffer, stringID)) { - fgets(buffer, MAX_LENGTH, file); - fgets(buffer, MAX_LENGTH, file); - fgets(buffer, MAX_LENGTH, file); - fgets(buffer, MAX_LENGTH, file); + for (int i = 0; i < 4; i++) { + fgets(buffer, MAX_LENGTH, file); + } strcpy(balance_String, buffer); balance = fetchBalanceFromBalanceString(balance_String); keep_reading = false; @@ -49,7 +48,7 @@ float getAvailableAccountBalance(int user_id) { FILE *file = fopen("CustomerData.txt", "r"); if(file == 0) { - printf("Erro: file cannot be opened!"); + printf("Error: customer data file cannot be opened!"); return 0; } else {