http://www.oschina.net/code/explore/glibc-2.9/string/strsep.c
1 #include <stdio.h> 2 #include <string.h> 3 4 int main() 5 { 6 char token[] ="abdzxbcdefgh"; 7 printf("%s\n",token); 8 char *tokenremain = token; 9 char *tok1 = strsep(&tokenremain,"cde"); 10 printf("tok1:%s,token:%s\n",tok1,tokenremain); 11 tok1 = strsep(&tokenremain,"cde"); 12 printf("tok1:%s,token:%s\n",tok1,tokenremain); 13 return 0; 14 }
[root@ test]# ./strsep
abdzxbcdefgh
tok1:ab,token:zxbcdefgh
tok1:zxb,token:defgh