2016-12-29 2 views
0

이미지를 나타내는 부호없는 char 배열이 있는데이를 웹 페이지에 표시하려고합니다.부호없는 문자 배열을 base64 문자열로 변환

나는 ActiveX 컨트롤의 배열을 얻을, 나는 자바 스크립트를 사용하여 내 웹 페이지에 보여주고 싶은, 그래서 내 질문에 서명 숯불로 변환하는 방법

그래서 나는 그에게 "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 
관련 문제