Sorry if the title is confusing. It might be better if I explain with the below code blocks.
Part of my code
typedef struct {
    char name[50];
    char num[9];
    char email[50];
} Contacts;
Contacts Contact[50];
void search() {
    char string[20];
    printf("What are you searching for: ");
    scanf("%19s", string);
    file = fopen("StoredContacts.txt", "r");
    while (!feof(file)) {
        
    }
}
StoredContacts.txt
Bobby,10,bobby@gmail.com
Abby,30,abby@gmail.com
Ada,20,ada@gmail.com
So basically my StoredContacts.txt contains names, ages and emails. I separated the contacts with a comma and they can be correctly registered into Contact.
What I want my search() to do is when I entered what I was looking for, the function would check each Contact and return me the full details of the person(s) I was looking for. For example, if I entered "A", I want it to print "Abby,30,abby@gmail.com" and "Ada,20,ada@gmail.com". If I entered "da", I want it to return "Ada,20,ada@gmail.com". I tried using bsearch and realised it couldn't print the details of the person(s).
 
    