ios - How to convert char(or Byte) with hexadecimal data in it, to an integer(decimal value) -


i have

char tem; 

its value shown blow:

printing description of tem: (char) tem = '\xd1' 

which should equals 209 in decimal.

my question how can implement conversion programmatically? want nsinteger equals 209 in case.

maybe there’s i’m overlooking here, given both char , nsinteger integral types, can’t do

char tem = '\xd1'; nsinteger = tem; 

? or perhaps, avoid surprises sign extension,

nsinteger = tem & 0xff; 

Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -