5 Jul
2003
5 Jul
'03
21:40
Jerry Feldman
I have an application where I am using popen: FILE *popen(const char *command, const char *type);
In a previous contract, we had a way to convert FILE * to fstream (instream or ostream). I prefer that my application be as pure C++ as possible. In a quick search, I have not found a safe way to do it.
If you're going to use gcc, see /usr/include/g++/ext/stdio_filebuf.h for a way to use a FILE * as a filebuf which you can use to construct a fstream. Note that the contents of this header is in namespace __gnu_cxx. Philipp