简体   繁体   English

base64编码null终止符

[英]base64 encode null terminator

Hi I am currently trying to encode a string using the base64 encoding method in C++. 嗨,我目前正在尝试使用C ++中的base64编码方法对字符串进行编码。

The string itself encodes fine however I would like to have an extra null character at the end of the decoded string (so the null character would also show up in the text file I want to save the decoded string into). 字符串本身编码良好,但是我希望在解码字符串的末尾有一个额外的空字符(因此该空字符也将出现在我想将解码后的字符串保存到的文本文件中)。

I am using this base64 code here -> http://www.adp-gmbh.ch/cpp/common/base64.html 我在这里使用此base64代码-> http://www.adp-gmbh.ch/cpp/common/base64.html

I hope you can give me some advices what I can do here to make this possible (I tried already writing two null characters at the end of the string I am encoding but it seems as if the encoding method only reads to the first occurence of a null character). 希望您能给我一些建议,以实现这一目标(我尝试在我正在编码的字符串的末尾写入两个空字符,但似乎编码方法只读取了第一次出现的a空字符)。

A cursory lookat the encoding function does not seem to show any special handling of NUL. 粗略地看一下编码功能似乎并未显示出对NUL的任何特殊处理。 And neither does the decoding function, are you sure the issue is not in the way that you test for NUL in the decoded string? 解码功能也不起作用,您确定问题出在测试解码字符串中的NUL方面吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM