Это возможно?
если брать fstream.h, а не fstream то у ofstream есть метод attach
и тогда:
FILE*f;
. . .
ofstream fs;
fs.attach(_fileno(f))
в fstream с этим как-то напряг:
template <class E, class T = char_traits<E> >
class basic_ofstream : public basic_ostream<E, T> {
public:
explicit basic_ofstream();
explicit basic_ofstream(const char *s,
ios_base::openmode mode = ios_base::out | ios_base::trunc);
basic_filebuf<E, T> *rdbuf() const;
bool is_open() const;
void open(const char *s,
ios_base::openmode mode = ios_base::out | ios_base::trunc);
void close();
};