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

Opening a file with WriteOnly truncates it

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • None
    • 5.1.1, 5.2.0
    • Documentation
    • None
    • Windows 32-bit, VS 2012, MingW32
    • 81e69ffdbac1e6f2066c2de3e5cfecbb923f2b15

    Description

      When opening a file with QIODevice::WriteOnly, it gets truncated.

      The documentation for OpenModeFlag doesn't mention this and the presence of QIODevice::Truncate implies that WriteOnly alone does not truncate the file.

      Attached is a file that reproduces the issue. The expected contents of test_file.txt after running the program are "testtest", but it ends up empty.

      The docs need to be clearer.

      Attachments

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

        Activity

          People

            veshivas Venugopal Shivashankar
            seishun Nikolai Vavilov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes