Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-26069

[Regression] QFile ( QIODevice::Append) append is broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Not Evaluated Not Evaluated
    • 4.8.3
    • 4.8.2
    • Core: I/O
    • None
    • Windows 7 + MSVS 2010
    • I62a26519a9401e547ff77bd8a71027cb361dc671

      If you try to append some text in an existing file it does not append rather it over writes it in the begining of the file, attached example shows this behavior

      #include <QFile>
      #include <QDebug>
      
      int main(int argc, char *argv[])
      {
          QFile file("myNewTestfile.txt");
          bool ret = file.open(QIODevice::WriteOnly);
          Q_ASSERT(ret);
          file.write("Testing First line\nTesting other line");
          ret = file.flush();
          Q_ASSERT(ret);
          file.close();
          Q_ASSERT(!file.isOpen());
      
          ret = file.open(QIODevice::WriteOnly | QIODevice::Append);
          Q_ASSERT(ret);
          file.write("APPEND new Line");
          ret = file.flush();
          Q_ASSERT(ret);
          file.close();
      }
      

      It is reported that it is limited to Windows only it works good on Linux

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            biochimia João Abecasis
            irfan.omair@gmail.com irfan B omair
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes