gpt4 book ai didi

c++ - 从无符号长十六进制转换为 DWORD

转载 作者:行者123 更新时间:2023-11-30 17:29:42 33 4
gpt4 key购买 nike

我需要从 unsigned long 进行转换(十六进制)到 DWORD .

我通常会

DWORD MyHex = 0x3F0000;

但是我得到了

unsigned long MyLong = 3f0000;

如何转换MyLong进入MyHex

当我只是以视觉方式将其打印到文件并执行操作时,这很好。

fprintf(pFile, "0x%X\n", MyLong);

但现在我需要实际使用该字符串作为 DWORD .

最佳答案

根据文档,DWORD实际上只是unsigned long的类型定义。无需转换。您可以像使用 DWORD 一样使用 MyLong

关于c++ - 从无符号长十六进制转换为 DWORD,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25549508/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com