将未签名的char数组转换为base64字符串
Convert unsigned char array to base64 string
我有一个无符号的char数组,代表图像,我想在网页中显示。
我从ActiveX控件中获得数组,我想使用JavaScript在网页中显示它,因此我必须将其转换为" Base64 String",因此我的问题是
如何将未签名的char数组转换为C 中的base64字符串?
苹果已经发布了开源base64编码/解码器。我记得在Windows项目上没有任何问题的编译。来源。标题在这里。
例如:
unsigned char* array = <your data>;
int len = <number of bytes in "array">
int max_encoded_length = Base64encode_len(len);
char* encoded = new char[max_encoded_length];
int result = Base64encode(encoded, (const char *)array, len);
// encoded is now a null terminated b64 string
// "result" is the length of the string *including* the null terminator
// don't forget to invoke "delete [] encoded" when done
相关文章:
- 防止主数据类型C++的隐式转换
- 模板参数替换失败,并且未完成隐式转换
- 努力将整数转换为链表。不知道我在这里做错了什么
- HEX值到wchar_t字符(UTF-8)的转换
- lambda参数转换为constexpr技巧,然后获取带链接的数组
- 将 BGR 图像转换为 jpeg 格式的 base64 字符串
- 如何在 c++ 中将 IStream 转换为 Base64 字符串
- 将图像.jpg转换为 Base64
- 如何将十六进制值字符串转换为 base64 字符串
- C++ 将 PNG 转换为 base64
- 将未签名的char数组转换为base64字符串
- 将 base64 解码字符串转换为无符号字符[32]
- 将Botan SHA256输出转换为base64,以匹配.NET SHA256 MALAGENG().computeHa
- 将解码的 Base64 字节字符串转换为布尔向量
- 将我的C++ Base64 代码转换为 Java 不起作用
- c++ OpenCV:将mat转换为base64,反之亦然
- Base64 转换器的输出不正确
- 使用Qt将二进制std::stringstream内容转换为base64(并返回)
- 如何在Qt中将Jpeg Base64字符串转换为jpeg图像
- 如何将二进制字符串转换为base64编码的数据