QString 转换成 wchar 的一个小陷阱
2024-10-09 01:27:28
QString::toWCharArray(wchar_t * array)
其中 wchar_t * array 除了要分配内存之外,必须用 wmemset 初始化。
环境是 Visual Studio 2015.
QT官方文档确实注明了:Note: This function does not append a null character to the array.
另一种转换方法
auto archiveWString = mArchive.toStdWString();
auto archive = const_cast<wchar_t *>(archiveWString.c_str());
出处:VRonin https://forum.qt.io/topic/92621/convert-qstring-to-wchar_t/20
最新文章
- CentOS7 Tomcat 环境部署
- HTML 表单和输入<;form>;<;input>;
- MQTT协议学习笔记
- DOM笔记整理及应用实例
- QQ拼音在中文输入下默认英文标点
- EIGRP汇总
- spring中的ResourceBundleMessageSource
- python xlrd对excel的读取功能
- 枚举+搜索 hdu-4431-Mahjong
- jQuery复习:第四章
- NBUT 1120 线段树
- Ubuntu16.04下安装Chrome出现“未安装软件包 libappindicator1”问题的解决办法
- python(day16)内置函数,匿名函数
- python使用协程并发
- java ssl 使用不同的加密套件,对性能影响很大
- BZOJ.4766.文艺计算姬(Prufer)
- linux下grep命令详解
- JAVA 画图板实现(基本画图功能+界面UI)二、功能实现及重绘实现
- 【hbuilder】如何根据Geolocation获得的坐标获取所在城市?
- 兼容主流浏览器的css渐变色