Thread1: EXC_BAD_ACCESS (code = 1, address = 0x68)

0

I'm having this problem on ide Xcode. In line 8 the warning

  

Thread1: EXC_BAD_ACCESS (code = 1, address = 0x68)

The .txt file is in the same folder where main is.

void construir1(struct elemento **P_inicio){
    FILE *arq;
    struct elemento *p1;
    char c;

    arq=fopen("t1.txt", "r");
    *P_inicio = NULL;
    while ((c= getc(arq))!=EOF) {
        if (c!='\n') {
            p1 = malloc(sizeof(struct elemento));
            p1->x = c;
            p1->prox = *P_inicio;
            *P_inicio= p1;
        }
    }
    fclose(arq);
    return;
};
    
asked by anonymous 27.03.2018 / 02:42

1 answer

0

It was really something of Xcode, it was not pulling txt. To resolve I went to the "Product> Scheme> Edit Scheme> Run> Working Directory" option and linkei the folder where the code and txt are. By doing this the program ran normally on the Mac.

    
26.06.2018 / 01:22