I have need to find a particular string from a text file. The user inputs the string they're looking for and the program searches through the opened text file to find that string. Is that possible?

void exam()
    char name[50], rollno[50];
    FILE *search;

    printf("\n\n\t\t\tPortal Examination");
    printf("\n\tEnter Name : ");
    scanf("%s", name);
    search = fopen("Students.txt", "r");
    //not sure where to go from here


To answer your question - yes it is possible.

I am not a C expert, but the principle I would use is to read in line by line. For each line see if the users' string exists. This assumes that the string you are searching for is completely on a line.

Assuming that the text file will never be a super huge file, you can read the whole file into memory and do multiple searches without reading the file each time.