在 C++ 中将 wtoi 与基数一起使用

Use wtoi with radix in c++

我需要将存储在 wchar_t C 风格字符串中的十六进制值转换为 int。 atoi 函数为此具有参数 radix,但 wtoi 仅采用 wchar_t。是否有函数(可用于 C++,许多 C 函数在 C++ 中已弃用)或其他方法来实现此目的?;

std::stoi is overloaded on both std::string and std::wstring 并采用可选的基本参数。您可以构造一个 std::wstring 形式的 wchar_t c 风格字符串。