请考虑以下代码:
std::stringstream test;
test << std::string("This is a test.");
std::string str;
test >> str;
std::cout << "\"" << str << "\"" << std::endl;
这只输出字符串" This ",而不是"This is a test“。
为什么会这样,我怎样才能得到整个字符串?
发布于 2013-03-11 23:50:04
std::string str = test.str();
https://stackoverflow.com/questions/15350771
复制