小编Tob*_*in2的帖子

当我尝试浏览文件时,它会覆盖我想要保存的数组吗?

    char * names[10];
    int i = 0;
    char theRow[20];

    while (fgets(theRow, 80 , fp) != NULL) {
        names[i] = theRow;
        i++;
    }
Run Code Online (Sandbox Code Playgroud)

我试图保存的数组的输出完全相同,具体取决于最后一个元素.

对于前 文件具有(hi,I,2,3,karl)
阵列然后变成(karl,karl,karl,karl,karl)

我错过了什么或者它能做什么?

c file

0
推荐指数
1
解决办法
79
查看次数

标签 统计

c ×1

file ×1