Using Files in JNI

0

i want working with files in JNI. I have this simple code:

JNIEXPORT jchar JNICALL Java_com_sistoleaudiocapture_Processing_prueba_1nativa(
        JNIEnv * env, jclass, jlong retorno, jbyteArray data, jint lenbytes) {




    FILE * cap_trig;
            fopen("/sdcard/SISTOLE_Audio/prueba.pcm","rb");
            fseek(cap_trig, 0L, SEEK_END);
            rewind(cap_trig);
            fclose(cap_trig);



}

When I only open a file and close it but the app crashes with this error libc(5744): Fatal signal 11 (SIGSEGV) at 0x00000028 (code=1), thread 5778 (AudioRecorder T).

In my manifest i have this permissions:

Help? Thanks

android
c++
java-native-interface

1 Answer

0

You forgot to assign to cap_trig.

cap_trig = fopen("/sdcard/SISTOLE_Audio/prueba.pcm","rb");

answered on Stack Overflow Jan 13, 2014 by leesei

User contributions licensed under CC BY-SA 3.0