friend BinaryStream& operator<<(BinaryStream &bStream, const std::string& inString );
BinaryStream& operator<<(BinaryStream &bStream, const std::string& inString )
{
std::string tempString(inString);
**** write(reinterpret_cast<char*>(&tempString), inString.length());
return bStream << inString;
}
I am getting an error :
BinaryStream.cpp:193: error: invalid conversion from ‘char*’ to ‘int’
BinaryStream.cpp:193: error: invalid conversion from ‘long unsigned int’ to ‘const void*
The write function has the following header:
void write( const char* buffer, int buffersize );
Secondly, what are you trying to do read or write? You seem to have a mixture of semantics going on. This should be a write, in which case this should be all you need.
BinaryStream& operator<<(BinaryStream &bStream, const std::string& inString )
{
return bStream << inString;
}