I have written this code to read from an input file and display the numbers:
#include<stdio.h>
int main()
{
int i;
FILE * f;
f=fopen("inputA.txt","r");
while (!feof(f)){
fscanf(f, "%i", &i);
printf("%i\t", i);
}
printf("\n");
}
The output shows the last number twice. I guess it is the problem of feof
but I don't know how to solve it. Any ideas?