我有Java Android应用程序(TestApp)。从我TestApp我打电话的功能从JNI代码:如何在jni中指定当前工作路径
JNIEXPORT jint JNICALL Java_com_app_test_testApp_CreateFile(JNIEnv* env, jobject thiz, jobject jclass) {
pFile = fopen ("/NDK_Log.txt", "a+");
// Get's current date time and print it in the log file.
dateTime = time(NULL);
currentTime = ctime(&dateTime);
fprintf(pFile, "\n\n--------------------------------------------------------------------------\n");
fprintf(pFile, "\t\t\t\t\t\t %s", currentTime);
fprintf(pFile, "--------------------------------------------------------------------------\n\n");
fprintf(pFile, ">>> Enter Initialize <<<\n");
#endif
return 0;
}
我要创建文件“数据/数据/ com.app.test.testApp /”文件夹,但我不能,我在做什么错,以及如何指定当前工作目录或给出当前应用程序的路径?
这意味着我无法通过NDK获取目录? –
您可以使用对Java代码的JNI调用来获取目录。 –