使用GetPrivateProfileInt,GetPrivateProfileString读取十六进制值的正确方法是什
What is the proper way to read hexadecimal values using GetPrivateProfileInt, GetPrivateProfileString?
现在我想从 ini 内部的变量中获取值,并将它们吐到 sendkey 函数上。所以目前这就是我在顶部定义它们的方式,显然不正确,因为我在测试变量时获得了默认值。
const int KeyAtk = GetPrivateProfileInt(L"BotSettings",L"AttackKey", 0xA2, L"config.ini");
const int KeyLoot = GetPrivateProfileInt(L"BotSettings",L"LootKey", 0x5A, L"config.ini");
//Counts
int CntAtk = GetPrivateProfileInt(L"BotSettings",L"PressAttack", 25, L"config.ini");
int CntLoot = GetPrivateProfileInt(L"BotSettings",L"PressLoot", 15, L"config.ini");
前面带有 const int 的值具有十六进制值,如 0xA2 和 0x5A,它们只是虚拟键代码。我希望能够随时更改此密钥,这就是为什么我不仅在sendkey函数中使用它,任何对如何让GetPrivateProfileInt读取十六进制值有想法的人。
GetPrivateProfileInt
不支持十六进制。如果要支持十六进制,则必须调用GetPrivateProfileString
并自行解析。
相关文章:
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- 通过方法访问结构
- 最小硬币更换问题(自上而下方法)
- C++为构建时间获取QDateTime的可靠方法
- 在C#中处理C++指针而不使用unsafe的最佳方法
- 处理多个异常集合的C++方法
- 如果C++类在类方法中具有动态分配,但没有构造函数/析构函数或任何非静态成员,那么它仍然是POD类型吗
- 有什么方法可以遍历结构吗
- 当类在C++中定义时,有什么方法可以"register"类吗?
- 在C++中,将大的无符号浮点数四舍五入为整数的最佳方法是什么
- 实现无开销push_back的最佳方法是什么
- 使用std::函数映射对象方法
- 有符号的int和int-有没有一种方法可以在C++中区分它们
- C++从另一个类访问公共静态向量的正确方法是什么
- C++优先级队列,按对象的唯一指针的特定方法升序排列
- 没有为自己的结构调用列表推回方法
- 有没有什么方法可以使用一个函数中定义的常量变量,也可以由c++中同一程序中的其他函数使用
- 在类定义之后定义一个私有方法
- 枚举环境变量的惯用C++14/C++17方法
- 初始化具有非默认构造函数的std::数组项的更好方法