1.QString & string
(1) QString转化为string
QString a;
string b = a.toStdString();
(2) string 转化为 QString
string a;
QString b = QString::fromStdString(a);
2.QString 转化为 char*
QString a;
string b = a.toStdString();
const char *ch = b.c_str();
3. string 转char*
string s ;
char * ch = s.c_str();
4. string & int
(1) string 转化为 int
string s;
int i = atoi(s.c_str());
(2) int 转化为 string
int i;
string s = std::toString(i);
5.stringstream
istringstream : 读string
ostringstream : 写string
stringstream :读写string
ostringstream : 写string
stringstream :读写string
头文件:
#include <string>
#include <sstream>
#include <sstream>
6. int 转化为unsigned short *
int temp;
unsigned short *j = (unsigned short*) &temp;
7. byte转换为string(16进制)
https://blog.csdn.net/dongdan_002/article/details/40889829
参考链接:https://blog.csdn.net/u010510020/article/details/73799996 int&string
https://blog.csdn.net/hjf161105/article/details/56941381 QString ,string ,char*
https://blog.csdn.net/lu_embedded/article/details/52465203 QString & char*
https://blog.csdn.net/chienchia/article/details/30750257
https://blog.csdn.net/hust_bochu_xuchao/article/details/52786449 char数组和string
https://www.cnblogs.com/Pillar/p/4206452.html string,char[],char*
https://blog.csdn.net/qq_24373811/article/details/52922272 int与unsigned等转换
https://blog.csdn.net/sophia1224/article/details/53054698 stringstream的使用方法