char) buffer with a given size to a debug ostream, escaping non-printable characters.
More...
#include <libcwd/buf2str.h>
Public Member Functions | |
| buf2str (char const *buf, size_t size) | |
Construct buf2str object with attributes buf and size. | |
Friends | |
| std::ostream & | operator<< (std::ostream &os, buf2str const &__buf2str) |
Write the contents of the buffer represented by __buf2str to the ostream os, escaping non-printable characters. | |
char) buffer with a given size to a debug ostream, escaping non-printable characters.
Converts size characters from character buffer pointed to by buf into all printable characters by either printing the character itself, the octal representation or one of \a, \b, \t, \n, \f, \r, \e or \\.
char const* buf = "\e[31m;Hello\e[0m;\n"; size_t size = strlen(buf); Dout(dc::notice, "The buffer contains: \"" << buf2str(buf, size) << '"');