C – 刷新std :: cout后得不到结果

C – 刷新std :: cout后得不到结果,第1张

概述using namespace std;string str{ "text" };stringstream ss{ str };cout.rdbuf(ss.rdbuf());cout.flush(); //cout<<endl; 这段代码可以打印文本,但什么也没有显示. 我把ss关联到stdout然后冲洗它,但我不知道为什么它不起作用,即使我参考很多插图. cout<<rdbuf(ss);
using namespace std;string str{ "text" };stringstream ss{ str };cout.rdbuf(ss.rdbuf());cout.flush(); //cout<<endl;

这段代码可以打印文本,但什么也没有显示.

我把ss关联到stdout然后冲洗它,但我不知道为什么它不起作用,即使我参考很多插图.

cout<<rdbuf(ss);

这没关系,但哪里有所不同? 总结

以上是内存溢出为你收集整理的C – 刷新std :: cout后得不到结果全部内容,希望文章能够帮你解决C – 刷新std :: cout后得不到结果所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1212161.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-04
下一篇 2022-06-04

发表评论

登录后才能评论

评论列表(0条)

保存