JNI编程中数据类型CString To jstring 转换

14年前
jstring CStringTojstring(JNIEnv *m_penv,CString convert)  {   jstring retjstring;   jchar dummystring[MAX_RESULT_INFO];   jsize iLoop;   jsize jlength = convert.GetLength();   // First copy the character to a unicode form   for (iLoop = 0; iLoop < jlength; iLoop++)    dummystring[iLoop] = (jchar) convert.GetAt(iLoop);   // I commented the following part because NewString takes the length to be converted   // and it doesn't look to the excess string   /*   // Fill the rest of the string with nulls   for (jLoop = iLoop; jLoop < MAX_RESULT_INFO; jLoop++)   dummystring[iLoop] = (jchar) "";   */   retjstring = m_penv->NewString(dummystring, jlength);   return retjstring;  }