首先,下载 MariaDB Connector/C++ 库
MariaDB Products & Tools Downloads | MariaDB
第二步,安装后
第三步,写代码
#include <iostream>
#include <cstring>
#include <memory>
#include <windows.h>#include <mariadb/conncpp.hpp>std::string utf8_to_gbk(const std::string& utf8_str) {if (utf8_str.empty()) return "";// 1. 计算需要的宽字符数组的大小int wideCharCount = MultiByteToWideChar(CP_UTF8, 0, utf8_str.c_str(), -1, NULL, 0);if (wideCharCount == 0) {retur