  | |  | Qsort | Qsort 2004-01-28 - By Dale Kingston
Back Ok question/problem, I had qsort sort my helpfiles. And I ran into an issue..... See before the CO that incorperated qsort hit I had 625 helpfiles, after the CO I had 168. Rather large decrease. I belive the problem might have come from the head pointer not being in order? Or maybe I'm wrong? Maybe you guys can see what I did wrong:
int srt_helps(const void *p1, const void *p2) { HELP_DATA help1 = *(HELP_DATA *)p1; HELP_DATA help2 = *(HELP_DATA *)p2;
if (help1.keyword == NULL) return 2; else if (help2.keyword == NULL) return 1;
return ( strcmp( help1.keyword, help2.keyword ) ); }
void sort_helps(void) { HELP_DATA *help; int i;
for (i = 0, help = help_first; help != NULL; help = help->next, i++);
qsort((void *)help_first, i, sizeof(help_first[0]), srt_helps);
return; }
-- ROM mailing list ROM@(protected) http://www.rom.org/cgi-bin/mailman/listinfo/rom
Earn $52 per hosting referral at Lunarpages.
|
|
 |