我会检查的前10个字节对的描述的测试文件中np.lib.format
和C++代码
从format.py
文件文档头的局部引用
Format Version 1.0
------------------
The first 6 bytes are a magic string: exactly ``\\x93NUMPY``.
The next 1 byte is an unsigned byte: the major version number of the file
format, e.g. ``\\x01``.
The next 1 byte is an unsigned byte: the minor version number of the file
format, e.g. ``\\x00``. Note: the version of the file format is not tied
to the version of the numpy package.
The next 2 bytes form a little-endian unsigned short int: the length of
the header data HEADER_LEN.
我还没有用另一种语言编写这个代码,但是确实想看看那些想在同一个文件中保存几个数组的SO的头文件。
loading arrays saved using numpy.save in append mode
我认为这将是明智的,用(A)一些广泛支持的矩阵的文件格式,例如[其中之一(http://docs.scipy.org/doc/scipy/reference/io。或者(B)写一些自定义的代码。 – sascha
写入.npy的代码是Python,应该很容易确定头部大小。寻找类似'lib/format.py'的东西。如果你没有numpy,看看github仓库。 – hpaulj