Something like the following should do. The Integer class overloads operator<< in integer.h:Integer n("0x0123456789012345678901234567890123456789");ostringstream oss;oss << std::hex << n;string str(oss.str());LPCSTR ptr = str.c_str();使用插入运算符时,Integer类始终打印后缀.在上面的代码中,由于std::hex,将附加 h .因此,您可能要添加:The Integer class always prints a suffix when using the insertion operator. In the code above, a h will be appended because of std::hex. So you might want to add:string str(oss.str());str.erase(str.end() - 1);另一种方法是使用功能 IntToString<Integer>() 来自misc.h.但是,它仅适用于窄字符串,而不适用于宽字符串.Another way to do it is use the function IntToString<Integer>() from misc.h. However, it only works on narrow strings, and not wide strings.Integer n("0x0123456789012345678901234567890123456789");string val = IntToString(n, 16) IntToString不打印后缀.但是,需要黑客才能以大写形式打印字符串(如手册中所示).IntToString does not print the suffix. However, hacks are needed to print the string in uppercase (as shown in the manual). 这篇关于将CryptoPP :: Integer转换为LPCTSTR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-25 20:22