#include <QDir> //头文件
QDir *TEST = new QDir;
bool exist = TEST->exists("TEST");
if(!exist)
bool ok = TEST->mkdir("TEST");
QString fileName = "TEST/1.txt";
QString str="今天的天气很好适合跑步";
QFile file(fileName);
if(!file.open(QIODevice::WriteOnly | QIODevice::Text|QIODevice::Append))
{
qDebug() << "open fail!" << endl;
}
QTextStream in(&file);
in<<":"+str<<"
";
file.close();