首页 > 其他 > 详细

QT文件读写

时间:2014-02-18 10:56:22      阅读:340      评论:0      收藏:0      [点我收藏+]

/*
//文件读取
QFile f("c:\\t.txt");
if(!f.open(QIODevice::WriteOnly | QIODevice::Text))
{
qDebug() << "Open failed";
return -1;
}
QTextStream txtOutput(&f);
QString s1("123");
quint32 n1(123);
txtOutput << s1 << " " << "caichao" << endl;
txtOutput << n1 << " " << 888 << endl;
f.close();
*/

///*
//读文件
QFile f("c:\\t.txt");
if(!f.open(QIODevice::ReadOnly | QIODevice::Text))
{
qDebug() << "Open failed";
return -1;
}
QTextStream txtInput(&f);
QString lineStr;
while(!txtInput.atEnd())
{
lineStr = txtInput.readLine();
QStringList strList = lineStr.split(" ");
qDebug() << strList;
}
f.close();
//*/

QT文件读写

原文:http://www.cnblogs.com/hermit/p/3553203.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!