on-internet
← Community

How do I print a vector of chars using fmt?

Stack Overflow ·

I have a const std::vector<char> - not null-terminated. I want to print it using the fmt library, without making a copy of the vector. I would have hoped that specifying the precision would suffice, but the fmt documentation says that : Note that a C string must be null-terminated even if precision is specified. Well, mine isn't. Must I make a copy and pad it with \0, or is there something else I can do?

Comments

Sign in or sign up to comment and upvote.

No comments yet.