Output Formatting with std::copy

I had to do some output formatting in C++ for showing the content of a buffer. Take for instance this buffer: unsigned char buffer [] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; I wanted the output to be like this: 0x00, 0x01, 0x02,…