[Previous]
[Contents]
[Next]

strpbrk(), _fstrpbrk()

locate an occurrence of one string in another

Synopsis:

#include <string.h>

char *strpbrk( const char *str,
               const char *charset );
char __far *_fstrpbrk( const char __far *str,
                       const char __far *charset );

Description:

The strpbrk() function locates the first occurrence in the string pointed to by str of any character from the string pointed to by charset.

The _fstrpbrk() function is a data-model-independent form of the strpbrk() function. It accepts far pointer arguments, and returns a far pointer. It is most useful in mixed memory model applications.

Returns:

A pointer to the located character, or NULL if no character from charset occurs in str.

Examples:

#include <stdio.h>
#include <string.h>

void main()
  {
    char *p = "Find all vowels";

    while( p != NULL ) {
      printf( "%s\n", p );
      p = strpbrk( p+1, "aeiouAEIOU" );
    }
  }

produces the output:

Find all vowels
ind all vowels
all vowels
owels
els

Classification:

strpbrk() is ANSI; _fstrpbrk() is WATCOM.
Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

strchr(), strrchr(), strtok()


[Previous]
[Contents]
[Next]