Otherwise, if you're like me, you'll keep wondering why no data has been written to the bottom BIO.
Also, you should really call
BIO_set_flags(b64,BIO_FLAGS_BASE64_NO_NL)
to make sure that the base64 BIO *b64 doesn't add (or expect) a newline at the end of each encoded chunk