#include #include #include #define TRUE 0 #define FALSE -1 void main(void){ char buff[128], b_buff[128]; char* tokenPtr; int pos; printf("** TESTTOK **\n"); getchar(); memset(buff, 0, sizeof(buff)); strcpy(buff, " 田中太郎 山本花子
"); memset(b_buff, 0, sizeof(b_buff)); strcpy(b_buff, buff); printf("buff = %s\n", buff); tokenPtr = strtok(buff, ""); if(tokenPtr != NULL) tokenPtr = strtok(NULL, ""); while(tokenPtr != NULL){/*while*/ pos = (int)(tokenPtr - buff); if(strstr(&b_buff[pos], "") != NULL) printf(" tokenPtr = [%s]\n", tokenPtr); tokenPtr = strtok(NULL, ""); }/*while*/ printf("**** END OF TOKEN ***\n"); getchar(); }