// 文本流
QFile file("aaa.txt");
file.open(QFileDevice::WriteOnly);
QTextStream stream(&file);
stream<<QString("hell oworld")<<123456;
file.close();
// 读取文本流
file.open(QIODevice::ReadOnly|QIODevice::Text);
stream.setAutoDetectUnicode(true);
while(!stream.atEnd()){
QString str = stream.readLine();
qDebug()<<str;
}
// 数据流
QFile file("bbb.txt");
file.open(QIODevice::WriteOnly);
QDataStream astrem(&file);
astrem<<QString("hello world")<<123456;
file.close();
file.open(QIODevice::ReadOnly);
QString str;
int num;
astrem>>str>>num;
qDebug()<<str<<num;
file.close();