• QT文件读写


    /*
    //文件读取
    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();
    //*/

  • 相关阅读:
    第八章 Libgdx输入处理(7)罗盘
    第六日
    第十日
    第五日
    第七日
    第九日
    第四日
    第三日
    使用EVM进行项目管理时的注意事项
    第八日
  • 原文地址:https://www.cnblogs.com/hermit/p/3553203.html
Copyright © 2020-2023  润新知