If i want to read 10 integers from a file i would write this:
But how to write a loop if i don't know how many integers will be in a file?Code:int main(){ int i; freopen("numbers.txt","r",stdin); for(i = 0; i <= 10; i++){ scanf("%d",&i); printf("%d",i); } fclose(stdin); return 0; }