【发布时间】:2017-12-01 13:39:19
【问题描述】:
我需要构建一个函数,我的输入是一个 char *string,我需要在 uint16 中获得“相同的表示”。
例如:
input: "12" --> output: 0x0012
input: "0" --> output: 0x0000
input "123" --> output: 0x0123
input "1234" --> output: 0x1234
PD:我不能使用strtol、sscanf等“官方函数”...
【问题讨论】:
-
然后考虑编写您的函数,如果您对此有任何疑问,请回来。
-
你忘了问问题,顺便说一句。
标签: c string hex converter strtol