得到第一个词(token)

来源:互联网 发布:在线视频加速软件 编辑:程序博客网 时间:2024/06/17 22:06
char *firsttok(const char *s,const char *delimiter,char first[])
{
        const char *p;
        const char *a;


        for(p = s;*p!='\0';++p) {
                for (a = delimiter;*a != '\0';++a) {
                        if (*p == *a) {
                                strncpy(first,s,p-s);
                                return first;
                        }
                }
        }
        return NULL;
}
原创粉丝点击