C++ 字符串相互转换 适合 lua project
#include <iostream> #include <Windows.h> #include <assert.h> #define Main main void wchar2char(char *Buf,const wchar_t* wchar) { int len = WideCharToMultiByte(CP_ACP, 0, wchar, wcslen(wchar), NULL, 0, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, wchar, wcslen(wchar), Buf, len, NULL, NULL); } //———————————————— //版权声明:本文为CSDN博主「bailang_zhizun」的原创文章,遵循CC 4.0 by - sa版权协议,转载请附上原文出处链接及本声明。 //原文链接:https ://blog.csdn.net/bailang_zhizun/article/details/80348282 wchar_t * char2wchar(const char* cchar) { wchar_t *m_wchar; int len = MultiByteToWideChar(CP_ACP, 0, cchar, strlen(cchar), NULL, 0); m_wchar =