I'm making a simple app in Android. I'm using NDK to make JNI calls. I have a file in a resource subfolder (raw), which I need to access from native c++ code. I want to read it from native using for example "ifstream" function but I don't get to do that.
That's my Java code:
Algorithm algorithm = new Algorithm();
    InputStream isModel = getResources().openRawResource(R.raw.model);
    String model = algorithm.ReadResourceFile(isModel);
    if(imgInput != null && txtResults != null)
    {
        Bitmap bmp = ((BitmapDrawable)imgInput.getDrawable()).getBitmap();
        //Convert Bitmap to Mat
        Mat image = new Mat(bmp.getHeight(), bmp.getWidth(), CvType.CV_8U);
        //Print results on txtResults
        String results = algorithm.DetectEmotionByImage(image.nativeObj, model);
        txtResults.setText(results);
    }
That's my C++ code:
JNIEXPORT jstring JNICALL
Java_org_ctic_emoplay_1android_algorithm_Algorithm_DetectEmotionByImage(JNIEnv *env,
                                                                        jobject instance,
                                                                        jlong image,
                                                                        jstring fileModel_,
                                                                        jstring fileRange_,
                                                                        jstring fileModelFlandmarks_,
                                                                        jstring fileHaarCascade_)
{
    const char *fileModel = env->GetStringUTFChars(fileModel_, NULL);
    SVM_testing testing;
    Mat* imageInput= (Mat*)image;
    Mat& inImageInput = *(Mat*) imageInput;
    string results = testing.TestModel(inImageInput, fileModel);
    const char* final_results = results.c_str();
    env->ReleaseStringUTFChars(fileModel_, fileModel);
    return env->NewStringUTF(final_results);
}
Anyone can help me? I'm desperated. Thanks!