📜  c - C++代码示例中的字符串到十六进制

📅  最后修改于: 2022-03-11 14:44:51.826000             🧑  作者: 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