I am trying to sort an array of pointers to a structure. I can sucessfully
sort if I specify the input list as:

     struct ENTRY linedata[MAX_ENTRIES];
...
    qsort(linedata, lineCnt, sizeof(ENTRY), compareLines);


and in my sort compare function I access the items as:

int compareEntry (const void * a, const void * b)
{
    struct ENTRY *e1 = (struct ENTRY*)a;
    struct ENTRY *e2 = (struct ENTRY*)b;
    char *c1;
    char *c2;
    int    value;

    c1 = e1->ruleValue;
    c2 = e2->ruleValue;

But if I specify the input list as:

     struct ENTRY *filters;
...
    qsort(filters, filtCnt, sizeof(ENTRY), compareFilters);

I can't figure out how to set the pointers properly. It should be
ptr->struct->element (I think), but I can't seem to figure it out.

Could some kind soul point me in the right direction? (no pun intended).

Thanks,

~Rick


[Non-text portions of this message have been removed]

Reply via email to