I'm looking at a code to learn things and I saw something like this :
void funRead(){
char str[80];
FILE *fi;
fi = fopen("file","r");
while(!feof(fi)){
fgets(str, 200, fi);
// do things
}
fclose(fi);
}
And it works! (It's quite a big code) I didn't understand why it was working so I tried to reproduce it (just this part, pretty much just the code above) and my program crashes (I'm doing it on Eclipse). It only works when I write
fgets(str, 80, fi);
Or another number < 80, otherwise it won't work.
Did I miss something?
EDIT : Screen capture of the part of the program I'm talking about https://gyazo.com/c8847ccc36bbbe7a406a3260db8dd358 Lines 4 & 26