This one is a short one (and actually, more an excuse to test highlight.js), but C++ Streams really, really suck. You can say whatever you want, they are the spawn of the devil. Case in point:
#include <iostream>
#include <iomanip>

void hexDump(
    const unsigned char * data,
    size_t size,
    std::ostream & str)
{
    size_t addr = 0;
    str << std::hex
        << std::setfill('0')
        << std::nouppercase
        << std::noshowbase;
    while (addr < size) {
        str << std::setw(8)
            << addr
            << ":   ";
        for (int i = 0; i < 16 && addr < size; i++) {
            str << std::setw(2)
                << static_cast<unsigned int>(data[addr++])
                << " ";
        }
        str << std::endl;
    }
    str << std::resetiosflags;
}