bool saveXMLStringToFile(const std::string& file_path,const std::string &content)
{
QFile file(file_path.c_str());
if (!file.open(QIODevice::WriteOnly))
{
return false;
}
//
QByteArray array = QByteArray::fromRawData(content.c_str(), strlen(content.c_str()));
QTextStream instream(&array);
QTextStream outstream(&file);
outstream.setCodec("utf-8");
outstream << instream.readAll() << endl;
}
给定一个std::string,如何令他以utf8的格式存进文本里面(利用qt)
最新推荐文章于 2024-03-27 15:26:49 发布