title: How to fill a C++ char[] with an JNI jobjectarray (Java String[])?
body: <p>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:</p>
  
  <pre>
  // 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 &lt 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);
  }
  </pre>
  
  <p>With this code I'll end up with <code>cppFilePaths</code> containing <code>elementCount</code> entries of the last String in <code>filePaths</code>.</p>
  
  <p>I searched a lot and found out about <code>strcpy</code>or <code>memcpy</code>, but nothing worked so far.</p>