C语言 C 中的杂散 \223 和 \224 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14159491/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 04:57:18  来源:igfitidea点击:

stray \223 and \224 error in C

c

提问by Amin Husni

I've gotten some stray errors with some other errors, I have no idea why :

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

[Error] stray '\223' in program

[Error] stray '\224' in program In function 'int readData(GymRecord**)':

[Error] 'q2' was not declared in this scope

[Error] request for member 'name' in '*(dir + ((long long unsigned int)(((long long unsigned int)k) * 8ull)))', which is of non-class type 'GymRecord*'

[Error] request for member 'age' in '*(dir + ((long long unsigned int)(((long long unsigned int)k) * 8ull)))', which is of non-class type 'GymRecord*'

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

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

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

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

[错误]请求'*(dir + ((long long long unsigned int)(((long 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);
}

回答by dandan78

You must have pasted some nicely-formated text from a website, but the compiler wants plain text. The problem is with your and characters. Replace them with ordinary quotes, ", and you should be fine.

您一定已经从网站粘贴了一些格式良好的文本,但编译器需要纯文本。问题出在你角色上。用普通引号替换它们,",你应该没问题。

回答by nos

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");