Results 1 to 1 of 1

Thread: Re: Reading binary files using readAll problem [SOLVED]

  1. #1
    Join Date
    Apr 2014
    Posts
    14
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Reading binary files using readAll problem [SOLVED]

    I thought everything was going fine until I compared the data I wrote into the binary file with the data I am reading, everything is the same except 6 bytes which are missing during reading!!

    Qt Code:
    1. file.write(towrite);
    2. qDebug()<<towrite.toHex();
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. data=file.readAll();
    2. qDebug()<<data.toHex();
    To copy to clipboard, switch view to plain text mode 

    the first piece of code gives:
    "400000931bad9c77bfbfbfbfb5eb75dfdfdfdfea40c870101 0101debebf80808080fc10ecc0c0c0c0ea76a8e06060605153 667050505051ca2cb82828282055c33c1c1c1c19faa0b60e0e 0e0c8b373309090908c1a9e7858585854a603dc2c2c2c2f717 b461a1a1a19d64db70d0d0d0c67e81b87878787e60539c3c3c3c3883988e2222222342856b 11111110c7226589898989f6a8e907b7d"

    while the second gives:
    "400000931bad9c77bfbfbfbfb5eb75dfdfdfdfea40c870101 0101debebf80808080fc10ecc0c0c0c0ea76a8e06060605153 667050505051ca2cb82828282055c33c1c1c1c19faa0b60e0e 0e0c8b373309090908c1a9e7858585854a603dc2c2c2c2f717 b461a1a1a19d64db70c67e81b87878787e60539c3c3c3c3883 988e2222222342856b11111110c7226589898989f6a8e907b7 d"

    Please help!
    I checked the binary file using a hex editor and the writing process was successful, nothing is missing.


    Added after 17 minutes:


    Just figured out the problem.. I was reading it as a text file. SOLVED!
    Last edited by Miss Engineer; 18th September 2014 at 16:19.

Similar Threads

  1. Reading a binary file with QT
    By YuriyRusinov in forum Qt Programming
    Replies: 7
    Last Post: 21st December 2012, 07:14
  2. Binary file Reading.........
    By umulingu in forum Qt Programming
    Replies: 11
    Last Post: 20th July 2009, 06:18
  3. problem with reading text files
    By Axsis in forum Newbie
    Replies: 1
    Last Post: 25th April 2008, 12:29
  4. Reading Binary Files
    By archanasubodh in forum Newbie
    Replies: 1
    Last Post: 27th February 2008, 12:31
  5. Reading binary data
    By vermarajeev in forum Qt Programming
    Replies: 1
    Last Post: 13th August 2007, 09:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.