I have a character range with pointers (pBegin
and pEnd
). I think of it as a string, but it is not \0
terminated. How can I print it to std::cout
effectively?
std::string
Do we have good solution? If not, what is the smoothest workaround?
You can use ostream::write, which takes pointer and length arguments:
std::cout.write(pBegin, pEnd - pBegin);