int main()
{
FILE* f;
f=fopen("test.txt","r");
int number;
while( ! feof(f) ) //; oops, ';' should not be here
{
fscanf(f,"%d",&number);
}
fclose(f);
}
oh and in your code you were reading formated text, the same as you would read a txt file with your eyes but char(-1) is a special character (EOF) and it doesn't even show... you need to read a character and than test it(i don't use fscanf but to read a character you musn't use %d)