您的位置:首页 > 其它

使用std流打印16进制字符串示例

2014-12-26 10:38 183 查看
//depend on  <sstream> and <iomanip> include.
//std::string _strLastError
std::ostringstream ostr;
fingerprint = libssh2_hostkey_hash(_session, LIBSSH2_HOSTKEY_HASH_SHA1);
ostr << "Fingerprint: ";
for (int i = 0; i < 20; i++) {
unsigned char c = fingerprint[i];
int nT = c;
ostr << std::hex << std::setw(2) << std::setfill('0') << nT;
}
_strLastError = ostr.str();


编译libssh要注意下面两个问题:

[1] 要依赖的头文件路径不是"D:\sdk\openssl-0.9.8o\include"而是“D:\sdk\openssl-0.9.8o\inc32”

[2]在用Visual Studio打开工程前,可以修改“D:\sdk\libssh2-1.4.3\win32\config.mk”中OpenSSL和Zlib路径的配置。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐