试图重新学习C/C++ 为什么当我运行此:的char *字符串从while循环
char* tmp;
while ((tmp = strtok(itr->c_str(),' ')) != NULL) {
std::string s(tmp);
cout << "S " << s<< endl;
}
我得到这样的:
/usr/include/c++/4.8.3/bits/basic_string.h:437:7: note: candidate expects 0 arguments, 1 provided
它要么或我做没有足够的论据。我知道tmp不是NULL,因为我正在while循环中检查它。 当我尝试string s = string(tmp);
我看到了文档,并且我以为除了我的需要以外,我都会将其复制下来。我明显错过了一些东西。
请不要反馈?
请发布* full *错误消息,最好使用[MCVE](http://stackoverflow.com/help/mcve),我们可以复制,粘贴和运行。 – chris
您的错误可能不在此代码段中。 – 2015-04-12 23:48:21
鉴于你已经接受了本的答案,我非常好奇剩下的错误是什么,因为它目前没有任何意义。 – chris