[SciPy-User] Write binary file from python and read from C++

Emmanuelle Gouillart emmanuelle.gouillart at normalesup.org
Thu Apr 7 16:27:42 EDT 2011


Hello Pierre,

would the ndarray.tofile method suit your needs?
>>> import numpy as np
>>> a = np.arange(10.)
>>> a.tofile('data.raw')

Cheers,
Emmanuelle

On Thu, Apr 07, 2011 at 10:22:08PM +0200, Puiseux wrote:
> Hello,


> I have a simple problem and could not find the solution in scipy/python doc.
> Maybe i did not search in the good place...

> I have some numpy.array (float32), and i want to write it in a binary 
> file with my own format.
> This file has to be readable  by a C++ program.

> Thats all.
> Thanks for your answer


> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user



More information about the SciPy-User mailing list