0
我有一个base 64编码的字符串,我想解码。 它看起来像这样:Base 64 decode在C中返回NULL
VGhpcyBpcyBhIGZpbGUgdGhhdCBJIHdhbnQgdG8gZGVjb2Rl
当我做..
gsize *out_len;
unsigned const char *decoded;
decoded = g_base_64_decode(myString, out_len);
,并打印出我的解码的字符串,我得到空也,我得到的断言: '!out_len = NULL' 失败来自Glib
这是怎么发生的?如何使用此功能正确解码我的字符串? https://developer.gnome.org/glib/stable/glib-Base64-Encoding.html#g-base64-decode-step
您是否为'out_len'分配了内存? – Barmar
'out_len'点无处。更换'gsize * out_len;'和'gsize out_len;'和'g_base_64_decode(MyString的,out_len);'和'g_base_64_decode(MyString的,与out_len);' –
@squeamishossifrage:发表它的一个答案! –