jint 转 jstring
jint cno=2;
char buf[64];
sprintf(buf, "%d",cno);
std::string namestd1= "";
namestd1.append(buf);
jstring 转char
const char * str = env->GetStringUTFChars(name,0);
char c[120] = "";//调用c++拼接字符函数strcat(c,str);
//释放env->ReleaseStringUTFChars(name,str);
或者
char names[40] ;
sprintf(names, "%s", name);
puts(names);
char 转 jstring
char s[256] = {0};
strcpy(s, namestd.c_str());
jstring a=env->NewStringUTF(namestd.c_str())
网友评论