Assume FILE_NAME is a global constant,
If I have the following code
FILE *file;
file = fopen(FILE_NAME, "r");
char string[30];
do
{
fgets(string, 30, file);
printf("%s", string);
}
while ( !feof(file) );
It prints all the lines in the txt file but the last one is printed twice. How do I prevent it from printing twice?