|
@ -1,5 +1,4 @@ |
|
|
#include "CreateCustomer.h" |
|
|
#include "CreateCustomer.h" |
|
|
#include "CustomerProperties.h" |
|
|
|
|
|
|
|
|
|
|
|
int main() |
|
|
int main() |
|
|
{ |
|
|
{ |
|
@ -81,4 +80,23 @@ void collectCustomerProperties() |
|
|
scanf("%f",&instance.balance); |
|
|
scanf("%f",&instance.balance); |
|
|
|
|
|
|
|
|
printf("Account successfully created. Your ID is: %d. Note it somewhere!\n",instance.ID); |
|
|
printf("Account successfully created. Your ID is: %d. Note it somewhere!\n",instance.ID); |
|
|
|
|
|
customer_t *referenceToCustomerInstance = &instance; |
|
|
|
|
|
writeCustomerPropertiesToFile(referenceToCustomerInstance); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void writeCustomerPropertiesToFile(customer_t *referenceToCustomerInstance) |
|
|
|
|
|
{ |
|
|
|
|
|
FILE *customerData = fopen("CustomerData.txt","a"); |
|
|
|
|
|
if(customerData!=NULL){ |
|
|
|
|
|
/*calling generateCheckString() at this place in future*/ |
|
|
|
|
|
fprintf(customerData,"ID=%d\nForename=%s\nSurname=%s\nPassword=%s\nBalance=%.4f€\n\n", |
|
|
|
|
|
referenceToCustomerInstance->ID,referenceToCustomerInstance->forename, |
|
|
|
|
|
referenceToCustomerInstance->surname,referenceToCustomerInstance->password, |
|
|
|
|
|
referenceToCustomerInstance->balance); |
|
|
|
|
|
fclose(customerData); |
|
|
|
|
|
} |
|
|
|
|
|
else{ |
|
|
|
|
|
printf("Error when accessing the file.\n"); |
|
|
|
|
|
exit(-1); |
|
|
|
|
|
} |
|
|
} |
|
|
} |