📜  字符串转十进制 c++ strtol - C++ 代码示例

📅  最后修改于: 2022-03-11 14:44:45.139000             🧑  作者: Mango

代码示例1
char hex[] = "6A";                          // here is the hex string
int num = (int)strtol(hex, NULL, 16);       // number base 16
printf("%c\n", num);                        // print it as a char
printf("%d\n", num);                        // print it as decimal
printf("%X\n", num);                        // print it back as hex