Posted on 2010-09-15 13:56 
Prayer 阅读(1513) 
评论(0)  编辑 收藏 引用  所属分类: 
C/C++ 
			 
			
		 
		  原型: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\n", token);
  }  
  return 0;
  }