Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

is const jchar * null terminated string in c++?

843829Sep 13 2010 — edited Sep 13 2010
hi,

i read through the complete JNI documentation.

i searched all possible srcs to know "is const jchar * string returned by method GetStringChars(JString,NULL) to c++ declared in jni.h is NULL terminated or not ?" but i couldn't find it.

please help me.

because i am using this const jchar * string directly in my c++ code by just casting it to (const WCHAR *)
sometimes it is crashing the jvm for no reason sorry! i dont know the reason.

Comments

timberlake1865 wrote:

i searched all possible srcs to know "is const jchar * string returned by method GetStringChars(JString,NULL) to c++ declared in jni.h is NULL terminated or not ?" but i couldn't find it.
No.
by just casting it to (const WCHAR *)
That of course is unlikely to be correct regardless of whether it was null terminated or not.
1 - 1
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 11 2010
Added on Sep 13 2010
1 comment
344 views