#include
<
string
>
using
namespace
std;
class
zbase64
;#include
"stdafx.h
"#include
"zbase64.h
"string
zbase64::encode(
const
unsigned
char
*data,
intdatabyte)
;int
linelength=0
;for
(inti=
0;i<
(int
)(databyte /3
);i++)}
//對剩餘資料進行編碼
intmod
=databyte %3
;if(mod==1
)else
if(mod==2
)return
strencode;
}string
zbase64::decode(
const
char
*data,
intdatabyte,
int&
outbyte);//
返回值string
strdecode;
intnvalue;
inti=0
;while
(i <
databyte)}i
+=4;}
else
//回車換行,跳過
}return
strdecode;}
使用示例(結合
cximage庫):
//把記憶體緩衝buffer中的資料構造成image物件
delete buffer;
cdc*
hdc
=m_picture.getdc();
m_bitmap
=image.makebitmap(hdc
->
m_hdc);
hbitmap h0ldbmp
=m_picture.setbitmap(m_bitmap);
if(h0ldbmp) deleteobject(h0ldbmp);
if(hdc
->
m_hdc) m_picture.releasedc(hdc);
if(m_bitmap) deleteobject(m_bitmap);
}
Base64編譯碼 C 版
include string using namespace std class zbase64 include stdafx.h include zbase64.h string zbase64 encode const unsigned char data,int databyte int li...
Base64編譯碼 C 版
include string using namespace std class zbase64 include stdafx.h include zbase64.h string zbase64 encode const unsigned char data,int databyte int li...
Base64編譯碼 C 版
include string using namespace std class zbase64 include stdafx.h include zbase64.h string zbase64 encode const unsigned char data,int databyte int li...