c++或者c语言把txt文件里的数据读取出来到一维数组

日期:2016-02-15 20:26:08 人气:2

c++或者c语言把txt文件里的数据读取出来到一维数组

#include int main(){ int i, cnt=0, a[100]; FILE *fp=fopen("abc.txt", "r"); if(!fp){ printf("文件不存在!\n"); return -1; } while(!feof(fp)){ fscanf(fp, "%d", &a[cnt]); cnt++; } fclose(fp); for(i=0; i<cnt; i++){
    A+
热门评论