Results 1 to 4 of 4

Thread: QFile::read failed after n bytes already read

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QFile::read failed after n bytes already read

    QFile::read failed after n bytes already read
    There's nothing wrong with the read() in the code you show us. It reads two blocks of 256k and the remainder of the file is 182276 bytes assuming the file you have opened contains 706564 bytes.

    The "QAbstractSocket::waitForBytesWritten() is not allowed in UnconnectedState" indicates that the TCP connection to the other end has been closed, possibly deliberately by the other end, possibly some other error condition. Nothing in the code we can see would help diagnose this. Try looking at QTcpSocket::error() or connecting to the error() signal.
    Last edited by ChrisW67; 3rd May 2013 at 02:49.

Similar Threads

  1. QTcpSocket can't read all bytes
    By Qiieha in forum Qt Programming
    Replies: 27
    Last Post: 23rd August 2011, 15:48
  2. Can somebody show how to read bytes?
    By "BumbleBee" in forum Newbie
    Replies: 36
    Last Post: 20th April 2011, 17:57
  3. How to read only a certain amount of bytes
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 28th January 2009, 07:38
  4. How to read more bytes using QTcpSocket?
    By vishesh in forum Qt Programming
    Replies: 1
    Last Post: 3rd July 2007, 20:23
  5. How to write bytes read from serial port to a QFile
    By shamik in forum Qt Programming
    Replies: 19
    Last Post: 25th June 2007, 14:12

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.