int main()
{
FILE *fp=NULL;
int a[160];
int i=0;
fp=fopen("data.txt","r");
if ( !fp )
{
printf("open file error\n");
return -1;
}
while( !feof(fp) )
{
if ( fscanf( fp , "%d" ,&a[i] ) !=1 )
break ;
i++;
fgetc(fp) ;//过滤掉分隔符
}
fclose(fp);
//以下倒序输出数据
printf("i=%d\n" , i );
while( --i >= 0 )
{
printf("%d," , a[i] );
if ( i %10 == 0 )
printf("\n") ;
}
return 0;
}