Access resource Files in C++

Put problems with the Android NDK in this forum.

Access resource Files in C++

Postby LukasBanana » Sun Aug 07, 2011 12:24 pm

Hi Folks,
Is it possible to access the resouce files with the NDK in C/C++?
I would like to use the ANSI-C FILE functions ("fopen", "fwrite" etc.).

In Java I read resource files as follows:

Code: Select all
InputStream stream = Context.getResources().openRawResource(int ResourceID)

try {
   final int size = stream.available();
   ByteBuffer buffer = ByteBuffer.allocateDirect(size);
   byte[] streamBuffer = new byte[size];;
   return true;
} catch (IOException e) {
   Log.e(TAG, "Could not read raw resource");

BTW: there is somewhere a good NDK API documentation? I can only find the Java docs
Posts: 7
Joined: Tue Mar 08, 2011 9:01 pm


Return to NDK Problems

Who is online

Users browsing this forum: No registered users and 1 guest