问题描述
大家好,
我在尝试使用Kevin Easton的base64
加密算法时遇到了一些问题。 (参见
)
这是我用来测试的示例程序algorythm。
-----启动main.c -----
#include< stdio.h>
#include" base64.h"
int main(无效)
{
char string [5] =" hello";
int len;
char string2 [10];
len = strlen(string);
printf("%s \ n",string);
b64_encode(string2,string,len);
printf(" ;%s \ n",string2);
返回0;
}
-----结束主.c -----
我使用以下方法编译程序:
gcc base64.c main.c -o base
当我运行它时,我得到以下输出。
mick @ codegurus $ ./base
hello ??(? ????
aGVsbG / wBCjG7L + / AQ == ???????(
有谁知道哪里出错了?
Hi Everyone,
I am having a few issues while attempting to use Kevin Easton''s base64
encryption algorythm. (See
http://groups.google.com/groups?selm...to.pcug.org.au)
here is a sample program I am using to test the algorythm.
----- start main.c -----
#include <stdio.h>
#include "base64.h"
int main(void)
{
char string[5] = "hello";
int len;
char string2[10];
len = strlen(string);
printf("%s\n", string);
b64_encode(string2, string, len);
printf("%s\n", string2);
return 0;
}
----- end main.c -----
I compile the program using:
gcc base64.c main.c -o base
And when I run it I get the following output.
mick@codegurus $ ./base
hello?(????
aGVsbG/wBCjG7L+/AQ==??????(
Does anyone know where its going wrong?
推荐答案
需要大小为6才能保留空字符。
Ed。
Needs to be size "6" to hold the null character.
Ed.
这篇关于奇怪的输出问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!