[Numpy-discussion] moving C++ binary data to numpy

David david@silveregg.co...
Mon Feb 7 18:30:17 CST 2011


On 02/08/2011 03:52 AM, Ilya Shlyakhter wrote:
> Is there a portable way to save vector of C++ structs to a binary
> file

C++ structs are not portable, so that sounds difficult. In practice, you 
have compiler-specific ways to enforce some alignement within a 
structure, but that sounds rather nightmarish to support.

Why can't you use a library with a portable file format (e.g. hdf5), or 
something like google protocol buffer/thrift/etc... ? Those are designed 
to solve your problem

cheers,

David


More information about the NumPy-Discussion mailing list