Boost logo

Boost :

From: Martin Slater (mslater_at_[hidden])
Date: 2005-10-04 03:33:15


Hi Stefan,

> I need to serialize my objects and then transfer them via tcp connection.
> Right now I write them into a file like in the examples and then open
> this file again read it with getc into an array, then send it.
> Is there an easier way without writing to a file, since this would be a
> problem with my performance.

Just use a std::stringstream, giving (untested)

  const GPSData g(10,10,10.0);
  std::ostringstream teststream;

  boost::archive::text_oarchive oa(teststream);
  oa << g;

  tcpclient->send(teststream.str().c_str());

HTH

Martin

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.9/117 - Release Date: 3/10/2005

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk