c语言分解字符串strtok函数使用
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <pthread.h> #include <semaphore.h> #include <unistd.h> #include <signal.h> #include <string.h> int main() { char pindata[] = "www.baidu.com"; //char *strtok(char *str, const char *delim) char* pout = strtok(pindata,"."); printf("pout is %s\n",pout); while(pout!=NULL) { pout = strtok(NULL,"."); printf("pout is %s\n",pout); } for(;;); return 0; }
一勤天下无难事。