📄 subject_16473.htm
字号:
<p>
序号:16473 发表者:大费 发表日期:2002-09-28 16:51:56
<br>主题:字符串操作的小问题。帮帮我啊!
<br>内容:用SDK做的<BR><BR>TCHAR strTemp[200]="|祝|大家|国庆节|愉快!";<BR>怎样把"|"分割开的数据取出来放到不同的字符串变量中间啊,<BR>"|"的个数不定,比如在这里是四个的情况下<BR>STR1=="祝";STR2=="大家";STR3=="国庆节";STR4=="快乐"<BR>
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:iwill 回复日期:2002-09-28 16:57:56
<br>内容:用strtok,msdn的例子:<BR><BR>Example<BR><BR>/* STRTOK.C: In this program, a loop uses strtok<BR> * to print all the tokens (separated by commas<BR> * or blanks) in the string named "string".<BR> */<BR><BR>#include <string.h><BR>#include <stdio.h><BR><BR>char string[] = "A string\tof ,,tokens\nand some more tokens";<BR>char seps[] = " ,\t\n";<BR>char *token;<BR><BR>void main( void )<BR>{<BR> printf( "%s\n\nTokens:\n", string );<BR> /* Establish string and get the first token: */<BR> token = strtok( string, seps );<BR> while( token != NULL )<BR> {<BR> /* While there are tokens in "string" */<BR> printf( " %s\n", token );<BR> /* Get next token: */<BR> token = strtok( NULL, seps );<BR> }<BR>}<BR><BR><BR>Output<BR><BR>A string of ,,tokens<BR>and some more tokens<BR><BR>Tokens:<BR> A<BR> string<BR> of<BR> tokens<BR> and<BR> some<BR> more<BR> tokens<BR><BR><BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:大费 回复日期:2002-09-28 17:17:07
<br>内容:哇噻!!这么好用的函数,哈哈,牛!!<BR>谢谢了。i will,
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -