stream::attach(int
fd) is not in the standard any more
Phil Edwards pedwards@disaster.jaj.com writes:
It was considered and rejected.  Not all environments use file
descriptors.  Of those that do, not all of them use integers to represent
them.
When using libstdc++-v3, you can use
#include <fstream>
basic_filebuf<...>::basic_filebuf<...>
__c_file_type* fileios_base::open_mode modeint size
but the the signature of this constructor has changed often, and
it might change again. For the current state of this, check
the howto for extensions.
For a portable solution (among systems which use
filedescriptors), you need to implement a subclass of
std::streambuf (or
std::basic_streambuf<..>) which opens a file
given a descriptor, and then pass an instance of this to the
stream-constructor.  For an example of this, refer to
fdstream example
by Nicolai Josuttis.
