c语言文件读入

int read(int arr[]){
int i=0,n,flag=0;
FILE *fp;
if((fp=fopen("shuru.txt","r"))==NULL){
printf("cantfind the file");
}
while(!feof(fp)){
if(flag==0){
fscanf(fp,"%d",&n);
flag=1;
}
else{
fscanf(fp,"%d",&arr[i++]);
}
}
fclose(fp);

return n;
}

原文地址:https://www.cnblogs.com/fanyu1/p/13689954.html