rogersce / cnpy

library to read/write .npy and .npz files in C/C++
MIT License
1.34k stars 301 forks source link

Not sure it's a issue or not. How could I parse std::string by using CNPY? #75

Open shuming1008 opened 3 years ago

shuming1008 commented 3 years ago

Hi Guys, thanks for providing such a convenient tool to parse NPZ.

Now I could parse double and uint64_t data from NPZ, but I can not parse numpy.str_ (e.g. std::string?)

Is it possible to parse string by using CNPY? If it is YES, could you give me a simple example to parse string?

Thanks!

shuming1008 commented 3 years ago

Additional Note:

I tried to parse string by use char. Due to string is various length. But it seems the read NPY file is incomplete, if parse NPY file with string/char type. I think there must be some issues here.

Riley16 commented 3 years ago

Yeah, I also am having difficulties loading in string arrays. The first few bytes read in from an array saved as "<UX" dtype are typically correct but other bytes seem to be overwritten with garbage.