Hi I'm tyring to use fgets in a C program to see whether or not a name exists in a line in a .csv file. If it does, then it saves it in an array then returns it. Right now, it saves everything line from the .csv file and I'm not sure why.
C file:
void FindRecord(char *filename, char *name, char record[]) {
    char *temp = record; //temp save record
    FILE *q = fopen(filename, "r"); //check that ths inputed .csv file exists
    if (q == NULL ) { //if it doesn't, then print error message and exit
        printf("This .csv does not exist");
        exit(1); //terminate with error message
    }
    while(!feof(q)) { //while I'm not at the end of the file
        fgets(temp, 1000, q); //Reads a line @ a time
        for (int i = 0; i < 1000; i++) {
            if(temp[i] == *name) {
                record[i] = temp[i];
                name++;
            }
        }
        printf("%s", record);
    }
    fclose(q);   
}
.csv file:
Kevin, 123-456-7890
Sally, 213-435-6479
Megan, 415-336-8790
Right now whats happening when I run the program is that it returns the 3 lines. I want iso that if *name points to the name "Kevin" and it comes with temp, it'll just return: Kevin, 123-456-7890
 
    