【发布时间】:2011-11-25 22:53:31
【问题描述】:
我有 Java Android 应用程序 (TestApp)。在我的 TestApp 中,我从 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;
}
我想在“data/data/com.app.test.testApp/”文件夹中创建文件,但我不能,我做错了什么,以及如何指定当前工作目录或提供当前应用程序路径?
【问题讨论】:
标签: android path java-native-interface android-ndk filepath