FILE *和istream:连接两个? [英] FILE * and istream: connect the two?
本文介绍了FILE *和istream:连接两个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设我弹出一个可执行文件,我得到一个 FILE *
。此外,假设我想将这个文件连接到一个 istream
对象,以方便处理,有办法吗?
Suppose I "popen" an executable, I get a FILE*
in return. Furthermore, suppose I'd like to "connect" this file to an istream
object for easier processing, is there a way to do this?
推荐答案
没有标准的方法,但如果你想要一个快速的解决方案,你可以得到文件描述符fileno(),然后使用Josuttis' fdstream 。可能有类似的努力,但我用这个在遥远的过去,它工作正常。如果没有别的,它应该是一个很好的地图来实施你自己的。
There is no standard way but if you want a quick solution you can get the file descriptor with fileno() and then use Josuttis' fdstream. There may be similar efforts around but I used this in the distant past and it worked fine. If nothing else it should be a very good map to implementing your own.
这篇关于FILE *和istream:连接两个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文