c++ 字符串转换16进制

日期:2017-09-05 14:44:44 人气:1

c++ 字符串转换16进制

#include #include #include #include using namespace std;std::string char2hex(std::string const &s){ std::string ret; for (unsigned i = 0; i != s.size(); ++i) { char hex[5]; sprintf(hex, "%#.2x ", (unsigned char)s[i]); ret += hex; } return ret
    A+
热门评论