格式化字符串问题
char cmdbuf[]= "set 1 hello world!";
我现在需要取出“hello world”(含有空格),hello前有多少个字符是未知的,
通过sscanf(cmdbuf, "set 1 %s", buf1)操作后取到的buf1是hello,因为遇到空格就结束了。
请问各位大侠有没有什么简单的方法能取出"hello world"?
[解决办法]
楼主哪去了啊,我都来两次了。。。
char cmdbuf[]= "set 1 hello world!";
string subStr = "hello";
string str = cmdbuf;
char * pFind = strstr(cmdbuf, subStr.c_str());
cout<<pFind<<endl;