I have old code running in Solaris that I am porting to linux. I already changed the header file from <fstream.h> to the standard fstream. the class is:
class UNITSocketStream : public fstream
{
public:
UNITSocketStream( UNITSocket & );
UNISocketStream( int sfd );
virtual ~UNITSocketStream();
private:
bool owned;
UNITSocketStream(const UNITSocketStream &);
UNITSocketStream & operator =( const UNITSocketStream &rhs);
};
and in the file cpp I have the initialization list:
UNITSocketStream::UNITSocketStream( UNITSocket &sockobj )
: fstream( sockobj.sockfd())
{
if ( fail() )
{
throw UNITSocketStreamInitFail(" bad stream ");
}
sockobj.disown();
}
// ============================================================================
UNITSocketStream::UNITSocketStream(int sockfd)
: fstream( sockfd )
{
if ( fail() )
{
throw UNITSocketStreamInitFail(" bad stream ");
}
}
So now When I compile I receive the error:
error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive] : fstream( sockobj.sockfd())
error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive] : fstream( sockfd ) in the lines where is invoked fstream().
Since in Solaris is available (LINK):
fstream(int fileno);
and in linux no, how I could traslate this call of fstream()?