strtok学习实例

来源:互联网 发布:速卖通产品数据分析 编辑:程序博客网 时间:2024/05/01 09:17

#include <string.h>
 
#include <stdio.h>
 
int main(void)
 
{
 
char input[16] = "njqy;123456789;XXXX;ADS;";

char *p;
 
p = strtok(input, ";");
 
if (p) printf("%s\n", p);
while((p = strtok(NULL,";")) != NULL){
 if (p) printf("%s\n", p);
}
}

原创粉丝点击