I have a problem using the function feof
, this is my code:
while(!feof(archlog))
{ if(!fgets(line,MAXLINE,archlog))
printf("\nERROR: Can't read on: %s\n", ARCHTXT);
else
printf("%s",line);
}
When I run this, it prints the text of the file but makes an extra loop and prints the ERROR, I want to avoid this, I want it to only print the text of the file without the extra loop.