std::string append too slow?
<p>I have a situation where I read data from a struct and keep appending it to a string so that it can be sent over a socket. When the data is fairly large, this operation is taking a lot of time. Can someone suggest any alternatives?</p>

<p>I have a structure</p>

<blockquote>
  <p>struct fileInfo
   {
      int file_id;
      char filename[16];
      double tag;
    }</p>
</blockquote>

<p>I do a std::stringstream >>file_id and stringstream.str()
this is repeated for each value, appended to a string and sent</p>
