Hi
I always have the same doubt, and I always forget to ask....
With this piece of code:
Code:
if (!(f = fopen (filename, "r")))
return;
while (!feof (f)) {
fscanf (f, "%s", data);
printf("%s\n", data);
}
I always get the last line of the file printed twice... Why is that happening???
What is the correct way to loop in a file?
Thank you.