Home
menubar
rss_feed

Previous Reference C++ Reference <cstring> Next Reference




C++ Reference: strpbrk()





strpbrk()


Declaration

char* strpbrk(const char* kcpString, const char* kcpChars);

Description

This function returns a pointer to the first occurrence of a character in the null-terminated set "kcpChars" that is inside the null-terminated string "kcpString."

Example

#include <cstdio>
#include <cstring>

int main()
{
    char caString[] = "XoaX.net";
    char caChars[] = "aei";
    // Find the first of "aei" inside of "XoaX.net"
    char* cpFound = strpbrk(caString, caChars);
    int iPos = (cpFound - caString);
    printf("First of %s found at %i\n", caChars, iPos);

    return 0;
}


Output:








Previous Reference C++ Reference <cstring> Next Reference




Home | Reference | Play Games! | Blog | Forum | Site Map | Contact Us


shadow bottom image