无法从istringstream中使用getline()函数(C++)

3

我之前声明了一个char c[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错误?
2个回答

5

2

一个展示C++真正“威力”的很好的演示。

你声明response_stream变量的方式,实际上它是一个函数而不是istringstream类型。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接