Forum Stats

  • 3,852,354 Users
  • 2,264,094 Discussions
  • 7,905,044 Comments

Discussions

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

843829
843829 Member Posts: 49,201
edited Sep 13, 2010 2:09PM in Java Native Interface (JNI)
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

  • jschellSomeoneStoleMyAlias
    jschellSomeoneStoleMyAlias Member Posts: 24,877 Gold Badge
    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.
This discussion has been closed.