Last Updated: October 04, 2016
·
616
· ashwin

Print data in HEX using C++

#include <iomanip>

for (int i = 0; i < size; ++i)
    std::cout << std::hex << std::setfill('0') << std::setw(2) << (int)data[i] << " ";
std::cout << std::endl;