0
我不能轉換的jstring到字符數組我如何將jstring轉換爲char數組?
JNIEXPORT jlong JNICALL Java_com_jnitest_JNI_getUid(JNIEnv * env,jobject thiz,jstring user){
const char *userName = (*env)->GetStringUTFChars(env,user,0);
(*env)->ReleaseStringUTFChars(env,user,userName);
FILE * f = fopen("/data/data/com.jnitest/p.txt","w");
if(f != NULL){
fprintf(f,"%c%c%c",userName[0],userName[1],userName[2]);
fclose(f);
}
return getUser(userName);
}
而且在文件p.txt我有這樣的:��