Results 1 to 2 of 2

Thread: Adding JString

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    4

    Adding JString

    Hey there I'm new in this forum. I'm a noob at coding in C++, and I'm trying to code a DLL to be loaded in Java.

    There a portion of my code, very simple:

    Code:
    JNIEXPORT jstring JNICALL Java_test_addString(JNIEnv *obj, jclass, jstring a, jstring b){
    	jstring c = obj->NewStringUTF((char*)obj->GetStringUTFChars(a,0));
    	jstring d = obj->NewStringUTF((char*)obj->GetStringUTFChars(b,0));
    	//...
    	return c+d;
    }
    Usually you can add 2 strings with '+' operator. But in this particular case, I'm going off my rocker. Apparently I can't add 2 strings in that way. I would use some enum\integral types, but dunno how to do that.

    Hope you can help me.
    Thank you for your attention.

  2. #2

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    4

    Re: Adding JString

    I found out a solution, only. Shortly I use 'strcat', and it works now.
    But is there other ways to do the same thing? I ask.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width