⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_16473.htm

📁 一些关于vc的问答
💻 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 &lt;string.h&gt;<BR>#include &lt;stdio.h&gt;<BR><BR>char string[] = "A string\tof ,,tokens\nand some&nbsp;&nbsp;more tokens";<BR>char seps[]&nbsp;&nbsp; = " ,\t\n";<BR>char *token;<BR><BR>void main( void )<BR>{<BR>&nbsp;&nbsp; printf( "%s\n\nTokens:\n", string );<BR>&nbsp;&nbsp; /* Establish string and get the first token: */<BR>&nbsp;&nbsp; token = strtok( string, seps );<BR>&nbsp;&nbsp; while( token != NULL )<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* While there are tokens in "string" */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf( " %s\n", token );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Get next token: */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;token = strtok( NULL, seps );<BR>&nbsp;&nbsp; }<BR>}<BR><BR><BR>Output<BR><BR>A string&nbsp;&nbsp; of ,,tokens<BR>and some&nbsp;&nbsp;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 + -