I programmed this little ‘gem’ a bit of time ago:
static Int16 asciisort(char* s1, char* s2)
{//recursive ascii sorter for SysQSort
//FIXME: fails if both strs are exactly the same
//0...p1==p2
//-1.p1 < p2
//1...p1 > p2
if(*s1< *s2)
{
return -1;
}
else if(*s1>*s2)
{
return 1;
}
else
{
return asciisort(++s1,++s2);
}
}
Don’t ask me why I did it recursively, but it was the easiest way to code it(imho). The code breaks when two filenames are exactly equal, but well, this rarely happens…
Related posts:
Exactly what StrCompareAscii does. So why do you write your own?
Hi Henk,
because:
a)I didnt have the API reference open while coding
b)Because I was bored
c)Because I was interested to do it myself
To be honest, I have no idea anymore though!
Best regards
Tam Hanna