函数原型
函数功能
函数使用说明
#include <string.h>
#include <stdio.h>
int main () {
char str[80] = " I - Love - You";
const char s[2] = "-";
char *token;
/* 获取第一个子字符串 */
token = strtok(str, s);
/* 继续获取其他的子字符串 */
while( token != NULL ) {
printf( "%s\n", token );
token = strtok(NULL, s);
}
return(0);
}
输出结果: