不同编码方式的文件采用对应的格式来读写.
如:
127.0.0.1
8080
192.168.8.162
4700
1
磁盘迁移
VxDiskTrans.exe
0
5
剪辑
VxClipEdit.exe
0
读方法:
QFile vXmlFile(m_XmlFileName);
if (!vXmlFile.open(QIODevice::ReadOnly))
{
qDebug() << m_XmlFileName;
Lib_WriteActuatorErr(QObject::tr("[读取配置]打开配置文件失败:") + m_XmlFileName);
vXmlFile.close();
return false;
}
QTextStream vReadStream(&vXmlFile);
QTextCodec *vCodec = QTextCodec::codecForName("UTF-8");
vReadStream.setCodec(vCodec);
QString vXmlDataStr = vReadStream.readAll();
vXmlFile.close();
if (!m_XmlDoc.setContent(vXmlDataStr))
{
Lib_WriteActuatorErr(QObject::tr("[读取配置]关联配置文件失败:") + m_XmlFileName);
return false ;
}
特别注意: "红色"字体部分
阅读(8396) | 评论(0) | 转发(0) |