char *strpbrk(const char *s, const char *accept);
The str function strpbrk returns a pointer to the first location in s where a character in accept occurs.
This could be a useful function for implementing a command line parser, or any other case where you want to be able to give it a bunch of unique characters, all jumbled up, and then test for the presence of different characters.

Hmm... One other use would be to screen user input. Just take it a byte at a time, like this:

if(ptr = strpbrk(user_input,list_of_valid_keys)) {
And you'll immediately be able to tell if it's a key you know how to handle or not...

Log in or register to write something here or to contact authors.