伙计们,需要搜索字符数组并将任何出现的“+”、“/”或“=”分别替换为“%2B”、“%2F”和“%2F”
base64output 变量看起来像
FtCPpza+Z0FASDFvfgtoCZg5zRI=
代码
char *signature = replace_char(base64output, "+", "%2B");
signature = replace_char(signature, "/", "%2F");
signature = replace_char(signature, "=", "%3B");
char replace_char (char *s, char find, char replace) {
while (*s != 0) {
if (*s == find)
*s = replace;
s++;
}
return s;
}
(错误出来)
s.c:266: warning: initialization makes pointer from integer without a cast
我究竟做错了什么?谢谢!