Results 1 to 3 of 3

Thread: Does bytesAvailable() decrease when read() is called?

  1. #1
    Join Date
    Apr 2007
    Posts
    62
    Thanks
    43
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Does bytesAvailable() decrease when read() is called?

    Upon QIODevice::readyRead() signal, suppose bytesAvailable() returns 50, and say that I read(40).

    If I call bytesAvailable() again, would it return 50, or 10?

    Thanks.

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

    Default Re: Does bytesAvailable() decrease when read() is called?

    It depends whether the device is sequential (10) or random access (0). Assuming the method returns 50 in the first place, the device is sequential, so it will return 10 or more (in case more data arrives in the meantime).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    ShaChris23 (9th July 2010)

  4. #3
    Join Date
    Apr 2007
    Posts
    62
    Thanks
    43
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Does bytesAvailable() decrease when read() is called?

    Thank you for the detailed answer. Yes, in my original, I meant it was sequential (socket), but you pointed out. Thanks!

Similar Threads

  1. Decrease the size of Application in Mac?
    By vishal.chauhan in forum Installation and Deployment
    Replies: 2
    Last Post: 26th March 2009, 10:54
  2. How to increase/decrease brightness/sharpness
    By rishiraj in forum Newbie
    Replies: 2
    Last Post: 21st January 2009, 06:25
  3. QUdpSocket and bytesAvailable
    By babu198649 in forum Newbie
    Replies: 0
    Last Post: 10th December 2008, 10:49
  4. need to decrease the library size
    By rohan_m_e in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 13th November 2008, 04:38
  5. QIODevice::bytesAvailable() always returning 0
    By quickNitin in forum Newbie
    Replies: 6
    Last Post: 14th June 2006, 13:04

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.