且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C ++将字符串转换为十六进制

更新时间:2022-06-04 04:32:58

使用 std:stoi 为(仅在C ++ 11中):

Use std:stoi as (in C++11 only):

std::string s = "5f0066";
int num = std::stoi(s, 0, 16);

在线演示