FILE * from std::ofstream?

topic posted Sun, June 11, 2006 - 10:58 PM by 
Share/Save/Bookmark
Advertisement

Hello, all ...

I need to interface a library that expects to communicate through a FILE * to my code written using ofstream. In these endeavors, I would like to just have my ofstream return a FILE * that this library can use, but I don't see how I can do that. The ofstream.rdbuf() returns a basic_filebuf, but there seems to be no way of getting a FILE * from it in a cross platform way (this code has to work on Mac OSX, using gcc, as well as Windows, using the MSVC.NET compiler).

Am I doomed to a C-style interface to my lower level file objects, just because this library expects a FILE *? I'm sure i'm not the only one who has run into this ...

Regards,

John

Falling You - exploring the beauty of voice and sound
www.fallingyou.com
posted by:
Advertisement
Advertisement