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;
}

  

posted @ 2020-09-13 11:24  卷哭你  阅读(318)  评论(0编辑  收藏  举报