[root@VM-0-16-centos openssl]# cat g.c
#include<stdio.h>
#include<openssl/bio.h>
int main()
{
int n = 0;
char *p = NULL;
BIO *mem = BIO_new(BIO_s_mem());
BIO_puts(mem, "123");
BIO_puts(mem, "456");
n=BIO_get_mem_data(mem, &p);
BIO_set_close(mem, BIO_NOCLOSE);
printf("%d %s\n", n, p);
BIO_free(mem);
return 0;
}
[root@VM-0-16-centos openssl]#
[root@VM-0-16-centos openssl]#
[root@VM-0-16-centos openssl]# gcc g.c -lcrypto
[root@VM-0-16-centos openssl]#
[root@VM-0-16-centos openssl]#
[root@VM-0-16-centos openssl]# ./a.out
6 123456
[root@VM-0-16-centos openssl]#
[root@VM-0-16-centos openssl]#