strtok()
MSDN的例子:
#include <string.h>
#include <stdio.h>char string[] = "A string\tof ,,tokens\nand some more tokens";
char seps[] = " ,\t\n";
char *token;void main( void )
{
printf( "%s\n\nTokens:\n", string );
/* Establish string and get the first token: */
token = strtok( string, seps );
while( token != NULL )
{
/* While there are tokens in "string" */
printf( " %s\n", token );
/* Get next token: */
token = strtok( NULL, seps );
}
}
MSDN的例子:
#include <string.h>
#include <stdio.h>char string[] = "A string\tof ,,tokens\nand some more tokens";
char seps[] = " ,\t\n";
char *token;void main( void )
{
printf( "%s\n\nTokens:\n", string );
/* Establish string and get the first token: */
token = strtok( string, seps );
while( token != NULL )
{
/* While there are tokens in "string" */
printf( " %s\n", token );
/* Get next token: */
token = strtok( NULL, seps );
}
}
解决方案 »
- 请问有gets()函数的替代函数可以超时自动退出吗?
- MFC初学者对这段代码的疑问,请解答
- List转成Tree
- 如何在Edit编辑框中,累加的输入文字?
- 求VC++1.52
- 请问如何用hough变换检测半径未知的圆(二值图象).
- 1、请问在win32 console application工程中,有没有可能画图??2、如果不行的话,我该怎么办??3、如果要移到工程MFC application中,
- 如何得到主盘的序列号?
- 怎么样在没有使用mfc的工程里面新建一个cdialog对象,并且使用资源里面的对话框
- 请推荐一个软件,送分!!!
- 我编译时产生了如下的错误
- 请问如何在用SDK编程中使用MFC类???? 急!!!
{
int nFind = s.Find(""");
if (nFind >= 0)
{
CString sYourVal = s.Left(nFind);
CString str = s.Delete(0,nFind);
}
}
好像叫做AfxTraceSubString();我忘记了
CString strResult;
strResult = str.Left(str.Find("\""));
str[0] = str[str.Find("\"")+1];
CString SubString;
AfxExtractSubString(SubString,string,0,'"');
第三个参数指定索引数,第四个参数指定子字符串间的分隔符。