4

I've gotten some stray errors with some other errors, and 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'

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);
}
Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Amin Husni
  • 149
  • 1
  • 1
  • 10
  • 2
    Syntax highlighting should help you... – Geoffroy Jan 04 '13 at 15:02
  • A much more direct analysis is to realise ‘\223’ ‘\224’ are octal → CE /CP-1250 [0x93 and 0x94](https://en.wikipedia.org/wiki/Windows-1250#Character_set) → U+201C LEFT DOUBLE QUOTATION MARK and U+201D RIGHT DOUBLE QUOTATION MARK – Peter Mortensen Mar 05 '21 at 11:13
  • This is a duplicate. The canonical is *[Compilation error: stray ‘\302’ in program, etc.](https://stackoverflow.com/questions/19198332)*. – Peter Mortensen Mar 05 '21 at 11:14

2 Answers2

29

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.

dandan78
  • 12,893
  • 12
  • 63
  • 75
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");
nos
  • 215,098
  • 54
  • 400
  • 488