c++ - 使用 swprintf() 打印 "0x0"的格式字符串应该是什么?

标签 c++

我尝试使用 swprintf(buff, 4, L"%#03x", value),但是当 value = 0 时,我得到 000 而不是 0x0

最佳答案

您需要字面值中的“0x”,例如“0x%03x”。 x 格式只打印十六进制数字,不添加 0x 装饰。

关于c++ - 使用 swprintf() 打印 "0x0"的格式字符串应该是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10824409/

相关文章:

c++ - Qt 的 std::unordered_set 模拟/对应

c++ - 如何使用 C++ 增加 Visual Studio 内部版本号?

c++ - C++0x 中的 Unicode 支持

c++ - Windows API - 使用 WriteFile 编写 std::string 的正确方法是什么?

c++ - 推导指南和注入(inject)的类名

c++ - <chrono> 溢出保证

c++ - 让角色看着玩家?

c++ - g++ : error: `pkg-config: No such file or directory

c++ - Rcpp 中 "List"的操作函数 - 类似于 R 中的 "Reduce function"

c++ - 有没有办法将其作为常量传递?