You've got to encode it in Base64.
As you're using C++, I can't tell much about that
I think you can find lots of samples on Internet. Or maybe a library you're using already has this functionality. Here's one :
http://base64.sourceforge.net/ [ March 07, 2007: Message edited by: Satou kurinosuke ]