Aviran
Aviran

Reputation: 5458

Accessing a resource file manually

I'm using a 3rd party library that does serialization and deserialization of it's data, I need to feed the library a data file that I have stored under Resources.

I can't use FileUtils to read the contents of the file, I need to do let the 3rd party library do the reading of the file.

I need to get the full path of the file so the library can find it.

FileUtils::getInstance()->fullPathForFilename("file.map");

returns assets/file.map on Android which is not found by ifstream when given that path.

How do I read a file manually, given that it's located in Resources?

Upvotes: 0

Views: 1061

Answers (1)

musikov
musikov

Reputation: 640

You can't use ifstream to operate with bundle resources on android because they're located in the apk file (in archive).

You can use the FileUtils::getInstance()->getDataFromFile("file.map") to get binary data and try to transfer it to your library.

Also You can look at this answer link to answer. It might help You too.

Upvotes: 2

Related Questions