#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *in;
int temp,sum=0;
if ((in=fopen("input.txt","r"))==NULL){
puts("ERROR");
return 1;
}
while(!feof(in)){
fscanf(in,"%i",&temp);
printf("%i ",temp);
}
fclose(in);
return 0;
}
выводит:
12 13 45 1 12 1 1
On success, the function returns the number of items of the argument list successfully filled. This count can match the expected number of items or be less (even zero) due to a matching failure, a reading error, or the reach of the end-of-file.