Open QFile for appending

后端 未结 1 1869
不知归路
不知归路 2020-12-02 02:01

How can I open a QFile for appending, i.e. the equivalent of

FILE *f = fopen(\"myfile.txt\", \"a\");
相关标签:
1条回答
  • 2020-12-02 02:05

    Open the file in QIODevice::Append mode:

    QFile f(...);
    if (f.open(QIODevice::WriteOnly | QIODevice::Append)) {
      ...
    }
    

    See also the documentation.

    0 讨论(0)
提交回复
热议问题