Main Page   Reference Manual   Namespace List   Compound List   Namespace Members   Compound Members   File Members  

libcwd::buf2str Class Reference
[Special Functions And Utilities]

Print a (char) buffer with a given size to a debug ostream, escaping non-printable characters. More...

#include <libcwd/buf2str.h>

List of all members.

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

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

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) << '"');
Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.