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!

Convert jstring to char array or int array

843829Apr 7 2003 — edited Apr 8 2003
Hi all, please help with the following code. I've tested this code with hard coded char array and it works. Now I have to get the char array from parameter "param1" which is passed from Java.
The following code compiled with error message:
error C2223: left of '->GetStringUTFChars' must point to struct/union

JNIEXPORT void JNICALL Java_DongleSet_DongleWrite(JNIEnv *env,jobject obj,jstring param1){

char HaspBuffer[500]=(char)env->GetStringUTFChars(param1,NULL);
int Service=MEMOHASP_WRITEBLOCK;
int SeedCode=300;
int LptNum=0;
int Pass1=pass1;
int Pass2=pass2;
int p1=0;
int p2=12;
int p3=0;
int p4=(int)HaspBuffer;

hasp(Service,SeedCode,LptNum,Pass1,Pass2,&p1,&p2,&p3,&p4);
}

I've tried this:char HaspBuffer[500]=env->GetStringUTFChars(param1,NULL);
And this:char HaspBuffer[500]=(*env)->GetStringUTFChars(param1,NULL);
All give me errors.
Please help.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 6 2003
Added on Apr 7 2003
3 comments
1,900 views