# Revision history [back]

Hi,

I suggest you to take a look to the way it is done in tool_topics:ShapeShifter

http://docs.ros.org/diamondback/api/topic_tools/html/shape__shifter_8h_source.html

I expect the function you want to write to look like this

void copyToString(ros::serialization::OStream& stream, std::string& output)
{
output.resize( stream.getLength()  );
memcpy(stream.getData(),  &output[0], stream.getLength());
}