This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

malfuction of strrpbrk ?

Hi there !

I have problems using the strrpbrk - fuction.
It is strrpbrk (double 'r !!). I always get a pointer
to anything but what is supposed as result.

By the way, the example from the handbook is not (!)
for strrpbrk !

Any ideas / examples ... ?

  • > I have problems using the strrpbrk - fuction.
    > It is strrpbrk (double 'r !!). I always get a pointer
    > to anything but what is supposed as result.

    It doesn't work for me either. Thank you for calling this to our attention.

    As a work-around until the library function is fixed, you can add to your project a .c file with a working version of strrpbrk(), like the following:

    #include <string.h>
    
    
    char *
    strrpbrk(
       char *string,
       char *set)
    {
       size_t i;
       char *scan;
       char c;
    
       for (i = strlen(string), string += i; i != 0; i--) {
          c = *--string;
    
          for (scan = set; *scan != 0; scan++) {
             if (*scan == c) {
                return (string);
             }
          }
       }
    
       return (NULL);
    }