|
|
@ -20,6 +20,7 @@ void replaceLineInFile(const char* file_name, int line, const char* new_line){ |
|
|
|
while (fgets(current_string, sizeof(current_string), file) != NULL) { |
|
|
|
if (current_line == line) { |
|
|
|
fprintf(temp_file, "%s", new_line); |
|
|
|
fputs("\n", temp_file); |
|
|
|
} else { |
|
|
|
fprintf(temp_file, "%s", current_string); |
|
|
|
} |
|
|
@ -81,3 +82,9 @@ 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; |
|
|
|
} |