Skip to main content
gamedev.net
🔒 Locked

Getting data from a numpy array to c++

Started by .chicken Sep 1, 2014 at 4:44 PM 0 replies 8.9k views
Original Post
.chicken
.chicken

Ok, I got another problem. I have a .npy file containing a numpy array[52][52][52][52].

I need the data from that array in my c++ application.

What is the easiest way to get that?

I found

https://github.com/rogersce/cnpy

but I'm unable to make it and keep getting errors..

Isn't there a way to simply save the array from within python to another file format? When I use


array = numpy.load("myfile.npy")
savetxt(array, "result.txt")

I get an error, I believe because the format it's loaded to doesn't work with the savetxt function?

Thanks in advance.

Edit:

Ok, got it solved. I loaded the 4dimensional numpy array, save it to a 1dimensional, by iterating over it, saved that to a .txt and then loaded that in c++ and stored the info back in an array.

Thanks anyway!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.