Problem writing to subdirectory with NDK code

Put problems with the Android NDK in this forum.

Problem writing to subdirectory with NDK code

Postby barney » Wed Jun 30, 2010 12:14 am

Hi,

I can successfully open and save files to the sd card with my C code using the NDK. However, when I try to write to a folder on the sdcard, say /sdcard/folder/file.txt, nothing happens. Any idea what to do? I used the external storage permission in the manifest file, so I don't know what the problem could be.

Thanks,

Barney
barney
Junior Developer
Junior Developer
 
Posts: 14
Joined: Tue Apr 28, 2009 5:40 am

Top

Re: Problem writing to subdirectory with NDK code

Postby lord_ure » Fri Jul 09, 2010 3:28 pm

I don't know wich permission you have setted up, but I do what you want in my code, and it works, here are my permission :
<uses-permission android:name="android.permission.WRITE_OWNER_DATA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MODE_WORLD_WRITEABLE" />
<uses-permission android:name="android.permission.MODE_WORLD_READABLE" />

Try this.
If it doesn't work show us you C and JAVA code.

++
Sorry for my english, I'm french ........ :(
lord_ure
Developer
Developer
 
Posts: 46
Joined: Fri Apr 16, 2010 4:29 pm
Location: Nancy, FRANCE

Re: Problem writing to subdirectory with NDK code

Postby barney » Fri Jul 09, 2010 8:11 pm

Hi lord_ure, thanks for your help. Turns out the permissions were not the problem, but I think I was hardcoding the wrong directory in the C code rather than calling Environment.getExternalStorageDirectory() in Java. When I passed the directory from my Java code, it worked fine. Thanks!
barney
Junior Developer
Junior Developer
 
Posts: 14
Joined: Tue Apr 28, 2009 5:40 am

Top

Return to NDK Problems

Who is online

Users browsing this forum: No registered users and 2 guests