Browse Source

Refactoring: Removed main function

remotes/origin/feature/update-current-customer-account-balance
fdlt3817 2 years ago
parent
commit
bbc6c7557f
  1. 14
      src/CustomerData.txt
  2. BIN
      src/a.exe
  3. 10
      src/updateCustomerAccountBalance.c

14
src/CustomerData.txt

@ -4,3 +4,17 @@ forename=Max
Surname=Mustermann
password=example
balance=2000
1327=example
ID=1327
forename=Max
Surname=Mustermann
password=example
balance=1500
1666=example
ID=1666
forename=Max
Surname=Mustermann
password=example
balance=240

BIN
src/a.exe

10
src/updateCustomerAccountBalance.c

@ -58,7 +58,7 @@ bool updateAvailableAccountBalance(int user_id, float changeInBalance, bool posi
strcat(stringID, user_id_as_string);
FILE *file = fopen("CustomerData.txt", "r+");
printf(stringID);
while(keep_reading) {
fgets(buffer, MAX_LENGTH, file);
currentLine++;
@ -81,11 +81,3 @@ bool updateAvailableAccountBalance(int user_id, float changeInBalance, bool posi
float newBalance = (positive) ? availableBalance+changeInBalance : availableBalance-changeInBalance;
replaceBalanceInString(newBalance,currentLine);
}
int main(){
updateAvailableAccountBalance(1234,500, true);
return 0;
}
Loading…
Cancel
Save