Add new cases inside the switch of the function errorMessage(). Remove the call to the function exit() inside errorMessage(). It is now done by the function that calls it. Now the different return values of this function make sense.
puts("CustomerData.* not found. Make sure that you've created an user account before logging in for the first time. Aborting!");
puts("CustomerData.* not found. Make sure that you've created an user account before logging in for the first time. Without users there is no file. Aborting!");
returnValue=-4;
returnValue=-4;
exit(-1);
break;
break;
case-5:
case-5:
puts("You should be at least 18 years old to create a bank account!");
puts("You should be at least 18 years old to create a bank account!");
@ -28,37 +27,30 @@ int errorMessage(int errorCode)
case-6:
case-6:
puts("Error when trying to open a file to create a customer account.");
puts("Error when trying to open a file to create a customer account.");
returnValue=-6;
returnValue=-6;
exit(-1);
break;
break;
case-7:
case-7:
puts("Forename too long. (length > 15 characters) Aborting!");
puts("Forename too long. (length > 15 characters) Aborting!");
returnValue=-7;
returnValue=-7;
exit(-1);
break;
break;
case-8:
case-8:
puts("Surname too long. (length > 15 characters) Aborting!");
puts("Surname too long. (length > 15 characters) Aborting!");
returnValue=-8;
returnValue=-8;
exit(-1);
break;
break;
case-9:
case-9:
puts("Password too long. (length > 20 characters) Aboring!");
puts("Password too long. (length > 20 characters) Aboring!");
returnValue=-9;
returnValue=-9;
exit(-1);
break;
break;
case-10:
case-10:
puts("You have entered an invalid character [ä,ö,ü, special characters] for your forename. This is not allowed. Aborting!");
puts("You have entered an invalid character [ä,ö,ü, special characters] for your forename. This is not allowed. Aborting!");
returnValue=-10;
returnValue=-10;
exit(-1);
break;
break;
case-11:
case-11:
puts("You have entered an invalid character [ä,ö,ü, special characters] for your surname. This is not allowed. Aborting!");
puts("You have entered an invalid character [ä,ö,ü, special characters] for your surname. This is not allowed. Aborting!");