ws2s函数
2024-08-29 13:28:58
std::string ws2s(const std::wstring& str)
{
char* pElementText;
int iTextLen;
// wide char to multi char
iTextLen = WideCharToMultiByte(CP_ACP, , str.c_str(), -, NULL, , NULL, NULL);
pElementText = new char[iTextLen + ];
memset((void*)pElementText, , sizeof(char)* (iTextLen + ));
::WideCharToMultiByte(CP_ACP, , str.c_str(), -, pElementText, iTextLen, NULL, NULL);
std::string strText;
strText = pElementText;
delete[] pElementText;
return strText;
}
std::string strKEy = ws2s(pKey);//pKey为WCHAR类型
char pStr[] = {};
strcpy_s(pStr, , strKEy.c_str());
最新文章
- 纯JSP实现简单登录跳转
- 答CsdnBlogger问-关于定时和后台服务问题
- @ControllerAdvice
- 编译安装-Nginx
- 源码分析:静态分析 C 程序函数调用关系图
- http错误码大全
- Bloglines订阅Blog部落格RSS网摘 - Blog透视镜
- 歪国人DIY的MINI四轴
- [CQOI2007]余数求和
- (poj 2502) Subway 最短路
- Django模型操作常用方法
- day52 js--- bom dom
- maya2018卸载/安装失败/如何彻底卸载清除干净maya2018注册表和文件的方法
- html-标签页
- MySQL中的运算符和时间运算
- Django-类视图与中间件
- Introduction to the Optimizer --cbo
- class() 高级用法 -- lua
- 『PyTorch x TensorFlow』第八弹_基本nn.Module层函数
- 三个和数组有关的程序题目(C++)