filebuf* rdbuf() const;
Return Value
Returns a pointer to the filebuf buffer object that is associated with this stream. (Note that this is not the character buffer; the filebuf object contains a pointer to the character area.)
Example
extern ofstream ofs;
int fd = ofs.rdbuf()->fd(); // Get the file descriptor for ofs