来自hex表示字符串的atoi()

需要从hex表示字符串中生成int,如"0xFA"或更好的"FA" 。 需要像atoi("FA")这样的东西。 那有什么标准的解决方案吗?

尝试使用strtol() :

 strtol("FA", NULL, 16);