You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
618 B
30 lines
618 B
#include "checkLoanEligibility.h"
|
|
#include "_file_information.h"
|
|
|
|
bool checkLoanEligibility(int user_id) {
|
|
|
|
// Eligible only when user is present in CustomerDataFile
|
|
|
|
bool keep_reading = true;
|
|
bool eligibility = false;
|
|
char buffer[MAX_LENGTH];
|
|
|
|
FILE *file = fopen(CUSTOMER_DATA_FILE, "r");
|
|
|
|
while(keep_reading) {
|
|
fgets(buffer, MAX_LENGTH, file);
|
|
|
|
if (feof(file)) {
|
|
keep_reading = false;
|
|
}
|
|
if(user_id == atoi(buffer)) {
|
|
eligibility = true;
|
|
keep_reading = false;
|
|
}
|
|
|
|
}
|
|
|
|
fclose(file);
|
|
return eligibility;
|
|
|
|
}
|