2016-12-29 19 views
0

イメージを表すunsigned char配列があり、これをWebページに表示したい。unsigned char配列をbase64文字列に変換する

ので、私の質問はunsigned char型に変換する方法

で、私はActiveXコントロールからの配列を取得し、私はJavaScriptを使用して自分のWebページでそれを表示したいので、私は「base64文字列」に変換する必要がありますC++のbase64文字列への配列ですか?

+1

チェックアウトhttp://stackoverflow.com/questions/342409/how-do-i-base64-encode-decode-in-c – pSoLT

答えて

0

AppleはオープンソースのBase64エンコード/デコーダーを公開しています。私はこのプロジェクトをWindowsプロジェクトで一度も問題なくコンパイルしたことを思い出します。ソースhere。ヘッダーhere。例えば

unsigned char* array = <your data>; 
int len = <number of bytes in "array"> 

int max_encoded_length = Base64encode_len(len); 
char* encoded = new char[max_encoded_length]; 

int result = Base64encode(encoded, (const char *)array, len); 

// encoded is now a null terminated b64 string 
// "result" is the length of the string *including* the null terminator 
// don't forget to invoke "delete [] encoded" when done 
関連する問題