OK, here's my sample code.
The problem is indicated with [PROBLEM] at the starting of the code line.
I'm getting a compilation error saying that:
706 C:\Users\user\Desktop\Project.cpp `reg_num' has not been declared
706 C:\Users\user\Desktop\Project.cpp request for member of non-aggregate type before ',' token
and its saying this for all my structure defined variables in that line.
pls help
Thanks
void search(char * record)
{
//char check[50];
//int search = 0;
int found = 0;
if((Clients=fopen("Clients.txt","r"))==NULL)
{
printf("THE FILE DATABASE IS EMPTY");
}
else
{
[PROBLEM] while(fscanf(Clients,"%s %s %s %s %s %s %s %s %s",record.reg_num,record.name,record.dob,record.address,record.phone,record.occupation,record.allergy,record.l_treatment,record.l_appointment)==9 && Found==0)
{
if(strcmp(record,record.reg_num)==0)
found=1;
}
if(found)
{
printf("\n\nREGISTRATION #: %s",record.reg_num);
printf("\n\nPATIENT'S NAME: %s",record.name);
printf("\n\nDATE OF BIRTH [day/month/year]: %s",record.dob);
printf("\n\nPATIENT'S ADDRESS: %s",record.address);
printf("\n\nPATIENT'S PHONE #: %s",record.phone);
printf("\n\nPATIENT'S OCCUPATION: %s",record.occupation);
printf("\n\nPATIENT'S ALLERGIES: %s",record.allergy);
printf("\n\nLAST TREATMENT: %s",record.l_treatment);
printf("\n\nLAST APPOINTMENT: %s",record.l_appointment);
}
else if(!found)
{
printf("\n\nTHERES NO SUCH RECORD");
}
fclose(Clients);
}
}