@ -21,6 +21,7 @@ void collectCustomerProperties()
bool inputTooLong = false ;
bool inputTooLong = false ;
printf ( " To create a new user, enter the information required below. \n " ) ;
printf ( " To create a new user, enter the information required below. \n " ) ;
printf ( " Enter forename (max. 15 letters): \n " ) ;
printf ( " Enter forename (max. 15 letters): \n " ) ;
userInput = getchar ( ) ;
while ( letterCounter < letterMaximum & & ( userInput = getchar ( ) ) ! = ' \n ' ) {
while ( letterCounter < letterMaximum & & ( userInput = getchar ( ) ) ! = ' \n ' ) {
* ( instance . forename + letterCounter ) = userInput ;
* ( instance . forename + letterCounter ) = userInput ;
+ + letterCounter ;
+ + letterCounter ;
@ -79,11 +80,8 @@ void writeCustomerPropertiesToFile(customer_t *referenceToCustomerInstance)
{
{
FILE * customerData = fopen ( " CustomerData.txt " , " a " ) ;
FILE * customerData = fopen ( " CustomerData.txt " , " a " ) ;
if ( customerData ! = NULL ) {
if ( customerData ! = NULL ) {
/*calling generateCheckString() at this place in future*/
fprintf ( customerData , " ID=%d \n Forename=%s \n Surname=%s \n Password=%s \n Balance=%.4f€ \n \n " ,
referenceToCustomerInstance - > ID , referenceToCustomerInstance - > forename ,
referenceToCustomerInstance - > surname , referenceToCustomerInstance - > password ,
referenceToCustomerInstance - > balance ) ;
fprintf ( customerData , " %s \n ID=%d \n Forename=%s \n Surname=%s \n Password=%s \n Balance=%.4f€ \n \n " ,
generateCheckString ( referenceToCustomerInstance - > ID , referenceToCustomerInstance - > password ) , referenceToCustomerInstance - > ID , referenceToCustomerInstance - > forename , referenceToCustomerInstance - > surname , referenceToCustomerInstance - > password , referenceToCustomerInstance - > balance ) ;
fclose ( customerData ) ;
fclose ( customerData ) ;
}
}
else {
else {