I remember having the same issues when I was sorting my skills list.. the srt_helps is where your problem lies.
use this as your NULL check. ---------------------------------------------- if (help1.keyword == NULL) return 1; else if (help2.keyword == NULL) return -1; ---------------------------------------------- That should solve your problem. -V ----- Original Message ----- From: "Dale Kingston" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, January 28, 2004 1:50 AM Subject: Qsort > 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 > [email protected] > http://www.rom.org/cgi-bin/mailman/listinfo/rom >

