I think the question says it all. I work with the Android NDK. I cannot include std, no use of vectors please, just plain and simple c++. Here's what I have so far:
// filePaths = jobjectarray = Java String[] int elementCount = env->GetArrayLength(filePaths); // this should end up being the char[] with the filePaths in it char *cppFilePaths[elementCount]; for (int i = 0; i < elementCount; i++) { jstring jFilePath = (jstring) (env->GetObjectArrayElement(filePaths, i)); const char *cppFilePath = env->GetStringUTFChars(jFilePath, 0); // this does not work! cppFilePaths[i] = cppFilePath; env->ReleaseStringUTFChars(jFilePath, cppFilePath); env->DeleteLocalRef(jFilePath); }
With this code I'll end up with cppFilePaths
containing elementCount
entries of the last String in filePaths
.
I searched a lot and found out about strcpy
or memcpy
, but nothing worked so far.