4

我遇到了一些杂散错误和其他一些错误,我不知道为什么:

[错误] 程序中出现杂散“\223”

[错误] 程序中的杂散 '\224' 在函数 'int readData(GymRecord**)' 中:

[错误] 'q2' 未在此范围内声明

[错误] '(dir + ((long long unsigned int)(((long long unsigned int)k) * 8ull)))'中的成员'name'请求,它是非类类型'GymRecord '

[错误] '(dir + ((long long unsigned int)(((long long unsigned int)k) * 8ull)))'中的成员'age'请求,它是非类类型'GymRecord '

int readData(struct GymRecord *dir[]){

    FILE *fdir = fopen(“q2.txt”, "r");
    char buff[MBUFF];
    int k = 0;

    while(k<MDIR && fgets(buff, MBUFF-1, fdir)){
        strcpy(dir[k].name,strtok(buff, ","));
        dir[k].age = atol(strtok(NULL, "\n"));
        k++;
    }

    return(k);
}
4

2 回答 2

29
于 2013-01-04T14:58:55.700 回答
5

Your quotes for the filename are the wrong ones. This line

FILE *fdir=fopen(“q2.txt”,"r");

Needs to be

FILE *fdir=fopen("q2.txt","r");
于 2013-01-04T14:59:01.927 回答