Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Access resource Files in C++

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);
   buffer.order(ByteOrder.nativeOrder());
   
   byte[] streamBuffer = new byte[size];
   
   stream.read(streamBuffer);
   stream.close();
   
   buffer.put(streamBuffer);
   buffer.position(0);
   
   return true;
} catch (IOException e) {
   Log.e(TAG, "Could not read raw resource");
   e.printStackTrace();
}


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

Top

Return to NDK Problems

Who is online

Users browsing this forum: No registered users and 6 guests