当前位置:网站首页>Qstring conversion char*
Qstring conversion char*
2022-07-27 04:36:00 【Li chongjun】
take QString turn char *, Need to use QByteArray class ,QByteArray See... For the description of class Qt Help document .
because char * Finally, there is one ’\0’ As an end sign , And use QString::toLatin1() The string will be followed by ’\0’.
QString str;
char* ch;
QByteArray ba = str.toLatin1(); // must
ch=ba.data();
That's it QString towards char * The transformation of . When the tested program runs, it will not appear bug. Pay attention to the 3 That's ok , We must add , Write alone , Can not be str.toLatin1().data() This step is complete , Otherwise, there may be mistakes .
Reference resources
QString and char* Mutual conversion of
边栏推荐
- 华为入局商用市场:趋势使然,挑战颇多
- 无有线网络下安装并配置debian
- Understand kingbasees V9 in one picture
- Anonymous named pipes, understanding and use of interprocess communication in shared memory
- shell编程增强
- RSA asymmetric encryption and decryption signature verification tool
- Elastic open source community: Developer Recruitment
- P1438 boring sequence line segment tree + difference
- JS modify the key value of the object array
- e. The difference between target and e.currenttarget
猜你喜欢

The difference between ArrayList and LinkedList

使用kubesphere图形界面dashboard开启devops功能

结构型模式-装饰者模式

BSN IPFS(星际文件系统)专网简介、功能、架构及特性、接入说明

【day02】数据类型转换、运算符、方法入门

Chapter 6: cloud database

grid布局

Playwright web crawler actual battle case sharing

People don't talk much, engineers don't talk much

Redis interview question (2022)
随机推荐
卷积神经网络——灰度图像的卷积
新手小白怎样开始学做自媒体呢?
[machine learning network] BP neural network and deep learning-6 deep neural networks (DNN)
shel自动设置目录权限
[C language] recursively explain the tower of Hanoi problem
Shel automatically sets directory permissions
0动态规划中等 LeetCode467. 环绕字符串中唯一的子字符串
RSA 非对称 加密解密 加签验签工具
使用Unity做一个艺术字系统
IIC 通信协议 (一)
Word/Excel 固定表格大小,填写内容时,表格不随单元格内容变化
结构型模式-外观(Facade)模式
The data in echart histogram is displayed at the top of the chart
微信小程序轮播图
Post analysis of Data Analyst
Yolov4网络详解
ROS camera calibration sensor_ Msgs/camerainfo message data type and meaning
【C语言】递归详解汉诺塔问题
详解左值、右值、左值引用以及右值引用
Px4 module design 12: high resolution timer design