If I had a buffer like:
uint8_t buffer[32];
and it was filled up completely with values, how could I get it into a stringstream, in hexadec
Look at the stream modifiers: std::setw and std::setfill. It will help you.
std::setw
std::setfill
#include <sstream> #include <iomanip> std::stringstream ss; ss << std::hex << std::setfill('0'); for (int i = 0; i < 32; ++i) { ss << std::setw(2) << static_cast<unsigned>(buffer[i]); }