11.07.2015 Views

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

PicC 9.50 dsPIC Manual.pdf

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Library FunctionsSTRTOKSynopsis#include char * strtok (char * s1, const char * s2)DescriptionA number of calls to strtok() breaks the string s1 (which consists of a sequence of zero or more texttokens separated by one or more characters from the separator string s2) into its separate tokens.The first call must have the string s1. This call returns a pointer to the first character of the firsttoken, or NULL if no tokens were found. The inter-token separator character is overwritten by a nullcharacter, which terminates the current token.For subsequent calls to strtok(), s1 should be set to a null pointer. These calls start searchingfrom the end of the last token found, and again return a pointer to the first character of the next token,or NULL if no further tokens were found.Example#include #include voidmain (void){char * ptr;char buf[] = "This is a string of words.";char * sep_tok = ".,?! ";}ptr = strtok(buf, sep_tok);while(ptr != NULL) {printf("%s\n", ptr);ptr = strtok(NULL, sep_tok);}217

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!