PDA

View Full Version : Does bytesAvailable() decrease when read() is called?



ShaChris23
8th July 2010, 22:01
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.

wysota
9th July 2010, 00:24
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).

ShaChris23
9th July 2010, 21:16
Thank you for the detailed answer. Yes, in my original, I meant it was sequential (socket), but you pointed out. Thanks! :)