我试过了 :
ostringstream oss;
read a string from file and put to oss;
string str;
str << oss.str();// error here "error: no match for ‘operator>>’ in 'oss >> str' "
如果我使用 str = oss.str();
而不是打印字符串的值,它会打印出 "....0xbfad75c40xbfad75c40xbf...."
喜欢内存地址。
谁能告诉我为什么?谢谢你。
原文由 Xitrum 发布,翻译遵循 CC BY-SA 4.0 许可协议