I need to return an array of string objects from my c++ program to java,how to go about it
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   jaanu_jhanvi
Posted On:   Wednesday, October 3, 2001 03:10 AM

I need to return an array of string objects from my c++ program to java,how to go about it,can anybody explain ,how to return array of arrays from native c++ program to java

thank
jaanu

Re: I need to return an array of string objects from my c++ program to java,how to go about it

Posted By:   Terry_Torres  
Posted On:   Tuesday, November 13, 2001 07:50 AM

Example in C..maybe this can help
----------------------------------
sbuf is a local array of chars
char *tpr;

tickes is
sclazz = (*env)->FindClass(env,"java/lang/String");

sz = arraytotalsize

newArr = (*env)->NewObjectArray(env,sz,sclazz,NULL);

for (i=0; i < sz; i++)
{
tptr = ticketsarray[i].buffer; sprintf(buf,"%s",tptr);
utf_str = (*env)->NewStringUTF(env,buf);
(*env)->SetObjectArrayElement(env,newArr,i,utf_str);
(*env)->DeleteLocalRef(env,utf_str);
}

// assign the array back to the incoming array

objTickets = newArr;
About | Sitemap | Contact