libcwdversion 2.0.0
The C++ Debugging Support Library
Loading...
Searching...
No Matches

Print a (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.

Detailed Description

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 \\.

See also
libcwd::char2str

Example:

char const* buf = "\e[31m;Hello\e[0m;\n";
size_t size = strlen(buf);
Dout(dc::notice, "The buffer contains: \"" << buf2str(buf, size) << '"');
buf2str(char const *buf, size_t size)
Construct buf2str object with attributes buf and size.
Definition buf2str.h:58
#define Dout(cntrl,...)
Macro for writing debug output.
Definition debug.h:97

The documentation for this class was generated from the following file: