Results 1 to 7 of 7

Thread: QIODevice::bytesAvailable() always returning 0

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QIODevice::bytesAvailable() always returning 0

    Could be because you connected the readyRead signal to a slot which may cause the data to be read before the other slot fires and has a chance to call bytesAvailable(). Also check if your file isSequential().

  2. #2
    Join Date
    Apr 2006
    Posts
    122
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    18

    Default Re: QIODevice::bytesAvailable() always returning 0

    thanks .i will check that. my file is a QFile object opening a fifo . i will check for that also

  3. #3
    Join Date
    Apr 2006
    Posts
    122
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    18

    Default Re: QIODevice::bytesAvailable() always returning 0

    fifoFile is not sequential

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,373
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QIODevice::bytesAvailable() always returning 0

    Quote Originally Posted by quickNitin
    fifoFile is not sequential
    I think bytesAvailable() will always return 0 in that case. But this is strange... fifos should be sequential... It might be a bug in QFile -- it might not check if file is a fifo. In that case you'll have to rely on readyRead() signal.

  5. #5
    Join Date
    Apr 2006
    Posts
    122
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    18

    Default Re: QIODevice::bytesAvailable() always returning 0

    in doc sth ambiguous is said about readyRead(). It says readyRead() is emitted everytime when new data is available or appeneded to file. In next para it says in a loop it may not be emitted again.
    I cannot understand this distiction fully.

  6. #6
    Join Date
    Apr 2006
    Posts
    122
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11
    Thanks
    18

    Default Re: QIODevice::bytesAvailable() always returning 0

    readyRead() signal is also not being generated while on other side of fifo brazenhem's line drawing algo is continuously puttin the points.
    I checked it by adding statement
    Qt Code:
    1. connect(&fileFifo,SIGNAL(readyRead()),qApp,SLOT(aboutQt()));
    To copy to clipboard, switch view to plain text mode 

    is it something abnormal or i am missing sth about behaviour of QIODevice with fifos.

Similar Threads

  1. Replies: 12
    Last Post: 14th June 2006, 10:24
  2. [DevQt] New versions, feature requests and bug reports
    By fullmetalcoder in forum Qt-based Software
    Replies: 103
    Last Post: 15th May 2006, 10:54

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.