int lire(int indice1) {
    int indice2 = 0;
    char c[1000];
    FILE *fptr;
    FILE *indice2r;
    indice1 = 0;
    fptr = fopen("Participant.txt", "r");
    if (fscanf(fptr, "%d", &indice1) == EOF) {
        return (indice1);
    } else {
        while (fscanf(fptr, "%d", &indice1) != EOF) {
            indice2r = fopen("indice2.txt", "w+");
            fscanf(indice2r, "%d", &indice2);
            for (indice2 = 0; c[indice2] != '\n'; indice2++) {
                fscanf(fptr, "%c", &c[indice2]);
            }
            fscanf(fptr, "%d", &indice1);
            indice1++;
            fprintf(indice2r, "%d", indice2);
        }
        fclose(indice2r);
        return indice1;
    }
}
My problem is that whenever my program goes into the for function that is supposed to stop after reading '\n' it keeps going and doesn't leave the loop.
 
     
     
    