There is no official way to get the private file handle of a file stream (or actualy a std::basic_filebuf), just because it should be portable and discourage use of platform-specific functions.
However, you can do ugly hack like inheriting std::basic_filebuf
and from that try to pry out the file handle. It's not something I recommend though as it will probably break on different versions of the C++ library.