Thanks for pointing it out Jim, actually that was a error in creating the
sample code for the post
the actual code looks more like the one show below
int main(int argc, char *argv[])
{
char ch[] = "adsf";
char enc[128];
int encSize= 128;
b64encode(ch, strlen(ch), enc, &encSize);
printf("[%s]\n", enc);
}
And yeah even with the correct size it still doesn't work.
here's the output i get from all the printfs
$./a.out
Bytes Written 4, (null)
[]
$
From: Jim Fox <[EMAIL PROTECTED]>
Reply-To: openssl-users@openssl.org
To: openssl-users@openssl.org
Subject: Re: Base64 encoding with BIO_new_mem_buf
Date: Thu, 12 Jul 2007 10:40:31 -0700 (PDT)
But what i really want is the encoded string in a char buffer.
And so i comment out <<<< 2 and use <<<< 1 instead. As its suppose to
write the encoded string into a buffer,
but the problem here is pEncBuf is empty even though bytesWritten says it
wrote 4 bytes.
And i can't explain why it won't work.
Your code is creating a mem buf of zero length. The second argument
to BIO_new_mem_buf is the actual length of the buffer.
Jim
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager [EMAIL PROTECTED]
_________________________________________________________________
http://liveearth.msn.com
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager [EMAIL PROTECTED]