1

Possible Duplicate:
Getting a FILE* from a std::fstream

Is there a way to obtain a FILE* from an a iostream derived class? Particularly from an fstream?

Community
  • 1
  • 1
Gayan
  • 1,697
  • 7
  • 26
  • 35

1 Answers1

1

No, at least not in a portable way.

GCC's libstdc++ has a class called stdio_filebuf that you can use with a stream, and it does allow you to directly get the associated FILE*, but, stdio_filebuf is not a basic_filebuf, and cannot be used with basic_fstream.

C. K. Young
  • 219,335
  • 46
  • 382
  • 435