Convert hexadecimal string with leading “0x” to signed short in C++?

前端 未结 6 828
孤城傲影
孤城傲影 2020-12-04 00:37

I found the code to convert a hexadecimal string into a signed int using strtol, but I can\'t find something for a short int (2 bytes). Here\' my p

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 00:55

    You can probably use stringtream class's >> operator with hex manipulator.

提交回复
热议问题