I\'m trying to implement a simple serialization/deserialization method for my code to be able to pass an object over the network using MPI. In an ideal world I would have us
The MPI way of doing this, would be using MPI_Pack
and MPI_Unpack
. Of course that is C and might not be as convenient as something using C++ features. For a simple example see http://www.mcs.anl.gov/research/projects/mpi/tutorial/mpiexmpl/src/bcast/C/pack/solution.html
Use an istrstream
, which extracts from a char
array. The header for this is <strstream>
. And, yes, formally it's deprecated in the C++ Standard. The committee indulged in a great deal of wishful thinking in its early days. istrstream
is not going to go away.