objective c - append unsigned char '\0' to NSString in iOS -


while converting unsigned char nsstring ,\0 not appending in nsstring.

example :

char str[]="123400005678"; unsigned char strval[20]; memset(strval,0x00,sizeof(strval)); int ret=unsignedchar2hex1byte(str,strval); 

after unsignedchar2hex1byte calculation strval output ,

strval[0] = '\x12' strval[1] = '4' strval[2] = '\0' strval[3] = '\0' strval[4] = 'v' strval[5] = 'x' 

but assigning strval nsstring upto \x124 output , 2 length of nsssting . can 1 explain , how assign entire strval nsstring or nsmutablestring , length of strval should 6.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -