The /data partition is read-only. Try writing to /sdcard.

Reminder: Native code is not supported.
R/

On Wed, Aug 27, 2008 at 2:06 AM, ccf2000 <[EMAIL PROTECTED]> wrote:
>
> Hi,all:
>    I want to write a program. application is writed by JAVA, and
> really feature is implemented in JNI.
> Next is JNI C code:
> JNIEXPORT void JNICALL Java_jprint_print(JNIEnv *env, jobject obj)
> {
>        {
>                remove("/data/a.log");
>                rename("/data/b.log", "/data/c.log");
>        }
>        printf("================hello jni===================\r\n");
> }
>
> JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved)
> {
>        JNIEnv *env;
>        JNINativeMethod meth;
>        jclass k;
>        jint r;
>
>        /*notes: next code will fail*/
>        {
>                remove("/data/a.log");
>                rename("/data/b.log", "/data/c.log");
>        }
>        r = (*vm)->GetEnv (vm, (void **) &env, JNI_VERSION_1_4);
>        k = (*env)->FindClass (env, "com.android.helloactivity.jprint");
>
>        meth.name = "print";
>        meth.signature = "()V";
>        meth.fnPtr = Java_jprint_print;
>        r = (*env)->RegisterNatives (env, k, &meth, 1);
>        return JNI_VERSION_1_4;
> }
>
> In my program, sometimes, I have to access file or display device via
> JNI C code.
> But the 'remove' and 'rename' do not be implemented successfully.
> It is successful when I run native C application that call
> Java_jprint_print() in emulator.
> So I think the failed reason is caused by JAVA application permission.
>
> Our JNI .so will be flash into manufactory's rom. so it is safe.
> Who can tell me how to invoke write operation(like write file) in
> Android JNI?
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Android Internals" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/android-internals?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to