自己写的工具类,附上源代码,在Linux下已经经过测试。
案例场景-1:
已知一个字符串“abcdefghijklmnopqrstuvwxyz0123456789”保存为了std::string str;,此时希望能看到这个消息(字符串)在内存中的16进制内容,保存到std::string hex中并输出。
答案:
str = "abcdefghijklmnopqrstuvwxyz0123456789";
wx::BinaryTracer::tracebin (str, hex);
std::cout << hex;
是不是很方便?喜欢?直接拿去用吧,代码分享与此。
=====
- Update: wxTracebin_20130203T0526
Add interface wx::BinaryTracer::tracebin_m (const char *, unsigned int, std::string &);