Hello!

    I want to create a BIO from a byte array and I want make the reverse operation (I want an byte array from a BIO). I'm having the next code...

/* From a byte array to a BIO*/

 BIO *bio=BIO_new(BIO_s_mem());
 BIO_set_mem_eof_return(bio,0);
 BIO_write(bio,(char *)byte_array, length_byte_array);

/* From the bio get the buf_mem and with the buf_mem get the unsigned char*/
 BUF_MEM *buf_mem=NULL;
 BIO_get_mem_ptr(bio,&buf_mem);

unsigned char *und=buf_mem.->data;
 cout<<"La longitud es:"<<buf_mem->length<<endl;

My question is:

Is it possible make it easier?

Thanks in advance,
Regards,
Antonio.
--
------------------------------------------------------
Antonio Ruiz Martínez
Facultad de Informática-Universidad de Murcia
30001 Murcia - España (Spain)
Telf: +34-968-364644 e-mail: [EMAIL PROTECTED]
------------------------------------------------------
 

Reply via email to