Replies: 1 comment
-
EDIT: I noticed that the build fails because
#include <vector>
#include <fmt/core.h>
#include <fmt/ranges.h>
int main() {
std::vector<int> vec{{10, 20, 30}};
fmt::print(L"{:02x}\n", fmt::join(vec, L" ")); // 0a 14 1e
fmt::print(L"{:02X}\n", fmt::join(vec, L" ")); // 0A 14 1E
fmt::print(L"{:#04x}\n", fmt::join(vec, L" ")); // 0x0a 0x14 0x1e
fmt::print(L"{:#04X}\n", fmt::join(vec, L" ")); // 0X0A 0X14 0X1E
} See also: https://fmt.dev/9.1.0/syntax.html |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to dump the wchar_t buffer as we do for char buffers ?
e.g.
void binary_example()
{
std::vector buf(80);
for (int i = 0; i < 80; i++)
{
buf.push_back(static_cast(i & 0xff));
}
spdlog::info("Binary example: {}", spdlog::to_hex(buf));
spdlog::info("Another binary example:{:n}", spdlog::to_hex(std::begin(buf), std::begin(buf) + 10));
// more examples:
spdlog::info("uppercase: {:X}", spdlog::to_hex(buf));
spdlog::info("uppercase, no delimiters: {:Xs}", spdlog::to_hex(buf));
spdlog::info("uppercase, no delimiters, no position info: {:Xsp}", spdlog::to_hex(buf));
spdlog::info("hexdump style: {:a}", spdlog::to_hex(buf));
spdlog::info("hexdump style, 20 chars per line {:a}", spdlog::to_hex(buf, 20));
}
Beta Was this translation helpful? Give feedback.
All reactions