JSON-based controller descriptions
[lsnes.git] / src / library / bintohex.cpp
bloba48f506ff19fae9b1689c0cbb1335dbbc8025325
1 #include "bintohex.hpp"
2 #include <sstream>
3 #include <iomanip>
5 std::string binary_to_hex(const uint8_t* data, size_t datalen) throw(std::bad_alloc)
7 std::ostringstream y;
8 for(size_t i = 0; i < datalen; i++)
9 y << std::setw(2) << std::setfill('0') << std::hex << static_cast<unsigned>(data[i]);
10 return y.str();