On Mon, Oct 17, 2005, Adam Jones wrote: > int main (void) > { > BIO *bmem, *b64; > BUF_MEM *bptr; > char message[] = "Hello World \n"; > int written = 0; > > b64 = BIO_new(BIO_f_base64()); > bmem = BIO_new(BIO_s_mem()); > b64 = BIO_push(b64, bmem); > written = BIO_write(b64, message, strlen(message)); > cout << written << endl; > BIO_get_mem_ptr(b64, &bptr); > BIO_flush(b64); > BIO_free_all(b64); > } > > This should be straight forward, but it is not. It appears that base64 > encoding to something other than stdout or a file does not work. I am using > vc++ 6.0, on windows platform. I can't get it to work with stdout either. I > get no compile or runtime errors. The &bptr gets a valid address, but the > address has nothing in it. Also the system tells me that 13 characters were > written, which is the correct number.Does anyone see why this is not working > correctly? I have even change the line BIO_get_mem_ptr(b64, &bptr); to > BIO_get_mem_ptr(bmem, &bptr); which does nothing. > > Thanks in Advance....... >
Have you tried looking at the contents of bptr before you free the BIOs? The BIO_free_all() calls will free up the memory buffer. Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]