Base64編譯碼 C 版

2021-09-22 13:24:19 字數 1231 閱讀 7436

#include

using namespace std;

class zbase64 ;

複製**

複製**

#include "stdafx.h"

#include "zbase64.h"

string zbase64::encode(const unsigned char* data,int databyte) ;

int linelength=0;

for(int i=0;i<(int)(databyte / 3);i++)

} //對剩餘資料進行編碼

int mod=databyte % 3;

if(mod==1)

else if(mod==2)

return strencode; }

string zbase64::decode(const char* data,int databyte,int& outbyte) ;

//返回值

string strdecode;

int nvalue;

int i= 0;

while (i < databyte)

} i += 4; }

else// 回車換行,跳過

} return strdecode; }

複製**

使用示例(結合cximage庫):

複製**

cstring cscandlg::encodeimage()

複製**

複製**

void cscandlg::decodeimagedata(cstring strdata)

cximage image(buffer,len,cximage_format_jpg);//把記憶體緩衝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,intdatabyte int lin...

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...