Gio::OutputStream 到 String 或 std::ostream
我正在使用库 libvtemm,它有一个函数 write_contents
。它需要一个内部缓冲区并将其输出到 Glib::RefPtrstd::string
或类似的内容,以便我可以使用内部数据并将其移动到其他数据结构。
有谁知道如何将 Gio::OutputStream
构造为 std::ostream
或将其内容转换为 std::string
>?
我看到有一个 Gio::MemoryOutputStream ,这样的东西对于将数据抓取到 std::ostream 有用吗?
I am using the library libvtemm, which has a function write_contents
. It takes an internal buffer and outputs it to a Glib::RefPtr<Gio::OutputStream>
object. I have been trying to find a way to convert the contents of the Gio::OutputStream into a std::string
or something similar so that I can play with and move around the data inside to other data structures.
Does anyone know how to either construct a Gio::OutputStream
to something like a std::ostream
or convert its contents into a std::string
?
I see there is a Gio::MemoryOutputStream
, would something like this be useful in grabbing the data to a std::ostream
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于那些正在寻找答案的人,以下是我将控制台缓冲区读入
std::string
的方法。希望这对将来遇到类似问题的人有所帮助。
For those of you who are looking for an answer, here is what I have come up with to read the console buffer into a
std::string
.Hope this helps someone in the future who comes across a similar problem.