base64-sample.c
来自「跨平台windowsunixlinux的c语言编程解决方案」· C语言 代码 · 共 47 行
C
47 行
/** * apr tutorial sample code * http://dev.ariel-networks.com/apr/ */#ifdef HAVE_CONFIG_H#include <config.h>#endif#include <stdio.h>#include <stdlib.h>#include <assert.h>#include <apr_general.h>#include <apr_base64.h>/** * base64 sample code * @remark Error checks omitted */int main(int argc, const char *argv[]){ apr_pool_t *mp; const char orig[] = "abcdefghijklmn"; char *encbuf; char *decbuf; int elen; int dlen; apr_initialize(); apr_pool_create(&mp, NULL); /* get the length of encoded string */ elen = apr_base64_encode_len(strlen(orig)); encbuf = apr_palloc(mp, elen); apr_base64_encode(encbuf, orig, strlen(orig)); printf("base64 encoded string: %s, len = %d\n", encbuf, elen); /* get the length of decoded string */ dlen = apr_base64_decode_len(encbuf); decbuf = apr_palloc(mp, dlen); apr_base64_decode(decbuf, encbuf); printf("decoded string: %s, len = %d\n", decbuf, dlen); apr_terminate(); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?