原型:char *strsep(char **stringp, const char *delim);
功能:分解字符串为一组字符串。
示例:
#include <stdio.h>
#include <string.h>
int main(void)
{
char str[] = "root:x::0:root:/root:/bin/bash:";
char *buf;
char *token;
buf = str;
while((token = strsep(&buf, ":")) != NULL){
printf("%s
", token);
}
return 0;
}