문제

This is my compare function...

int nameSort(const struct dirent** file1, const struct dirent** file2){

    char* a = *file1 -> d_name;
    char* b = *file2 -> d_name;
    //printf("comparing %s     AND    %s\n", a, b);
    return strcasecmp(a,b);
}

am error: request for member ‘d_name’ in something not a structure or union What is wrong here?

도움이 되었습니까?

해결책

Precedence of -> member selection via pointer operator is higher over * defense operator, so

 *file1->d_name;

should be:

 (*file1)-> d_name;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top