@ -21,6 +21,7 @@ void collectCustomerProperties()
bool inputTooLong = false ;
printf ( " To create a new user, enter the information required below. \n " ) ;
printf ( " Enter forename (max. 15 letters): \n " ) ;
userInput = getchar ( ) ;
while ( letterCounter < letterMaximum & & ( userInput = getchar ( ) ) ! = ' \n ' ) {
* ( instance . forename + letterCounter ) = userInput ;
+ + letterCounter ;
@ -79,12 +80,9 @@ 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 \n Forename=%s \n Surname=%s \n Password=%s \n Balance=%.4f€ \n \n " ,
referenceToCustomerInstance - > ID , referenceToCustomerInstance - > forename ,
referenceToCustomerInstance - > surname , referenceToCustomerInstance - > password ,
referenceToCustomerInstance - > balance ) ;
fclose ( customerData ) ;
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 ) ;
}
else {
printf ( " Error when accessing the file. \n " ) ;