rephraze ur question a bit
所在版块:社会百科 发贴时间:2004-03-29 23:30

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
strsep
Syntax
#include <string.h>

char *strsep(char **stringp, char *delim);

Description
This function retrieves the next token from the given string, where stringp points to a variable holding, initially, the start of the string. Tokens are delimited by a character from delim. Each time the function is called, it returns a pointer to the next token, and sets *stringp to the next spot to check, or NULL.

Return Value
The next token, or NULL.

Portability
not ANSI, not POSIX

Example
main()
{
char *buf = "Hello there,stranger";
char **bp = &buf;
char *tok;
while (tok = strsep(bp, " ,"))
printf("tok = `%s'\n", tok);
}

tok = `Hello'
tok = `'
tok = `there'
tok = `stranger'

.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

团结努力,不怕牺牲,排除万难.
我们要发达.
 

 相关帖子 我要回复↙ ↗回到正文
C programming 问题 香蕉   (143 bytes , 393reads )
如果没理解错你的问题,你可以这样做 鱽鳓   (130 bytes , 319reads )
rephraze ur question a bit chancing   (698 bytes , 328reads )
more info available here chancing   (100 bytes , 305reads )