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,738
  • 21
  • 105
  • 131
Amin Husni
  • 148
  • 1
  • 1
  • 10
  • 3
    Syntax highlighting should help you... – Jaffa 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 ***very*** common error when copying code from web pages, [PDF](https://en.wikipedia.org/wiki/Portable_Document_Format) documents, through chat (e.g. [Skype Chat](https://en.wikipedia.org/wiki/Features_of_Skype#Skype_chat) or [Facebook Messenger](https://en.wikipedia.org/wiki/Facebook_Messenger)), etc. – Peter Mortensen May 03 '23 at 19:47

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
  • 13,328
  • 13
  • 64
  • 78
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
  • 223,662
  • 58
  • 417
  • 506