I am trying to try search a file for a record based on on a number is enter which is printed to a file under registratation number.I just want to know if my coding is correct.Below is a sample of the module.
{
struct custinfo info;
FILE *customer;
char number[5];
int x;
printf("\n\n\t PLEASE ENTER A THE REGISTRATION NUMBER TO BE FOUND:");
scanf("%s",&number);
customer = fopen("customer.txt","r");
do
{
if (info.regis!=number)
{
fscanf(customer,"%s\n",info.regis);
fscanf(customer,"%s %s\n",info.fname,info.lname);
fscanf(customer,"%s\n",info.treatment);
fscanf(customer,"%s\n",info.allergies);
fscanf(customer,"%s %s %s\n",info.date1,info.month1,info.year1);
fscanf(customer,"%s %s %s\n",info.date,info.month,info.month);
}
else
{
printf("\n\n\t\t\t THE RECORD HAS BEEN FOUND");
printf("\n\n\t\t\t REGISTRATION: %s",info.regis);
printf("\n\n\t\t\t CUUSTOMER NAME: %s %s",info.fname,info.lname);
printf("\n\n\t\t\t TREATMENT: %s",info.treatment);
printf("\n\n\t\t\t ALLERGIES: %s",info.allergies);
printf("\n\n\t\t\t DATE OF BIRTH: %s / %s / %s",info.date1,info.month1,info.year1);
printf("\n\n\t\t\t DATE OF LAST APPOINTMENT: %s / %s / %s",info.date,info.date,info.year);
break;
}
}while(number!=info.regis);
fclose(customer);
}