2012-07-04 2 views

답변

0

여기 좀

http://java.sun.com/docs/books/jni/html/other.html (섹션 "8.2 쓰기 국제화 코드")

당신이 jstring으로에 기본 인코딩 된 문자열로 변환 (결국 자바로 전달에 관심이있을 수있는 기능을하시기 바랍니다 - 측, JNU_NewStringNative이다 환호

jstring JNU_NewStringNative(JNIEnv *env, const char *str) 
{ 
    jstring result; 
    jbyteArray bytes = 0; 
    int len; 
    if ((*env)->EnsureLocalCapacity(env, 2) < 0) { 
     return NULL; /* out of memory error */ 
    } 
    len = strlen(str); 
    bytes = (*env)->NewByteArray(env, len); 
    if (bytes != NULL) { 
     (*env)->SetByteArrayRegion(env, bytes, 0, len, 
            (jbyte *)str); 
     result = (*env)->NewObject(env, Class_java_lang_String, 
            MID_String_init, bytes); 
     (*env)->DeleteLocalRef(env, bytes); 
     return result; 
    } /* else fall through */ 
    return NULL; 
} 

,

관련 문제