That's not a compilable program which shows your problem.
If I use the example exams file from your post #1:
Code:
$ cat Exams.txt
5 1 Lab 01
17 2 Lecture(31.10.)
and turn your code snippet into a working program:
Code:
#include <stdio.h>
int main(void)
{
char tmp[100];
FILE *fin=fopen("Exams.txt", "r");
fgets(tmp, sizeof(char)*100, fin);
printf("%s", tmp);
fclose(fin);
return 0;
}
I get the following output:
That's why I've asked for a small, compilable program which shows that you get the output 5 times, because as you can see the code snippet you have posted just outputs the line once.
Bye, Andreas