android - How to convert ascii to char in NDK? -


i trying use convert ascii char in android ndk gives me fatal error segement , app force stops. code:

value = "116"; char word = atoi(value); return (*env)->newstringutf(env, word); 

error:

 fatal signal 11 (sigsegv) @ 0x00000074 

you need provide newstringutf() c-string (i.e. array of char ending null):

value = "116"; char word[2]; word[0] = atoi(value);  // first char converted want word[1] = 0;            // null termination (aka '\0')               return (*env)->newstringutf(env, word); 

Comments

Popular posts from this blog

angularjs - Showing an empty as first option in select tag -

qt - Change color of QGraphicsView rubber band -

php - Cloud9 cloud IDE and CakePHP -