searching backwards through a string

Is there a way to search backwards through a character array without using the STL? I've tried using strrchr() but I can't get it to search the 2nd instance backwards.
thanks
friz
An option would be to create your own upgraded version of strrchr, taking an additional parameter that points to the last character in the string to be searched:
1
2
3
4
5
6
7
const char * mystrrchr ( const char * str, int character, char * end )
{
  while (end!=str)
    if (*end == character) return end;
    else --end;
  return 0;
}
Thanks I'll try this out.
Topic archived. No new replies allowed.