diff options
author | Erwin Nindl <nine@wirdorange.org> | 2007-12-11 13:53:03 +0000 |
---|---|---|
committer | Erwin Nindl <nine@wirdorange.org> | 2007-12-11 13:53:03 +0000 |
commit | b49e5993550f6c762b03a8de70ff7bf70a3ad011 (patch) | |
tree | 51d5d3d4802dc47c9b82ff1a2577a2042947e3c3 /buffer.cpp | |
parent | debuging sync buffer (diff) |
added pretty buffer print
Diffstat (limited to 'buffer.cpp')
-rw-r--r-- | buffer.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -180,17 +180,20 @@ Buffer::operator u_int8_t*() // just for write/read tun return buf_; } -void Buffer::printHexDump() const +std::string Buffer::getHexDump() const { char text[10]; + std::string ret = ""; for( u_int32_t index = 0; index < length_; index++ ) { std::sprintf(text, "%#4x", buf_[index]); - std::cout << text << " "; + ret += text; + ret += ""; if( ((index+1) % 10) == 0 ) - std::cout << std::endl; + ret += '\n'; } + return ret; } Buffer Buffer::operator^(const Buffer &xor_by) const |