C++——实现base64编码
不废话,直接开整
使用C++的文件操作,读取图片,实现base64编码,编码结果打印到控制台(未实现文件写入),测试可通过👉图片转Base64编码 - 在线工具 - OKTools
代码如下
#include <iostream>
#include <fstream>
#define MAX 1200
using namespace std;
const char *base64_code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
void base64_encode(char *path1) {
unsigned char buffer[MAX];
ifstream file_read;
file_read.open(path1, ios::binary);
while (!file_read.eof()) {
file_read.read