C++ Can';来自istringstream(C+;+;)的t getline()
我有一个先前声明的C++ Can';来自istringstream(C+;+;)的t getline(),c++,string,iostream,stringstream,C++,String,Iostream,Stringstream,我有一个先前声明的charc[64]我试图查看管道输出的第一个单词: read(pipe_replacement_to_main[READ_END], c, BUF_SIZE); istringstream response_stream(string(c)); string response_string; getline(response_stream, response_string, ' '); gcc在第四行给了我以下信息: error: no matching function f
charc[64]代码>我试图查看管道输出的第一个单词:
read(pipe_replacement_to_main[READ_END], c, BUF_SIZE);
istringstream response_stream(string(c));
string response_string;
getline(response_stream, response_string, ' ');
gcc在第四行给了我以下信息:
error: no matching function for call to ‘getline(std::istringstream (&)(std::string), std::string&, char)’
我甚至不知道它是如何调用函数的。我是否声明istringstream错误?,在响应\u流的构造函数中添加一对括号
istringstream response_stream((string(c)));
<>一个很好的演示C++的真正“力量”
按照您声明response\u stream
变量的方式,它实际上是一个函数,而不是类型istringstream
istringstream response_stream((string(c)));