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

If you read a file that is opened with fopen to QFile it adds extra NULL when reading it

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.6.3, 4.7.4, 4.8.0
    • Core: I/O
    • None
    • Windows 7

      If you read a file and write it to another file you cannot use fopen to read it. When using fopen it adds extra 0x00 marks to the output file.

      The example below adds extra 0x00 marks:

      QFile fi;
      fi.open(fopen("input.txt","r"),QIODevice::ReadOnly);
      

      The example below won't add extra 0x00 marks:

      QFile fi("input.txt");
      fi.open(QIODevice::ReadOnly);
      

      I attached simple test application (bug.zip) to reproduce the issue. I included input.txt and output.txt to the same package which you can use to see the difference (you have to open those files with a hex editor).

      Also, I attahed logs.zip where are logs when running the application while QIODEVICE_DEBUG flag is defined.

      This cannot be reproduced on Mac/Linux

        1. bug.zip
          0.9 kB
        2. Logs.zip
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Unassigned Unassigned
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes