[fpc-pascal] Improve THandleStream.Size for VFS on Linuxx

Michael Van Canneyt michael at freepascal.org
Tue Oct 8 08:40:46 CEST 2019



On Tue, 8 Oct 2019, Alexey Tor. wrote:

> Ubuntu 18.x x64. FPC 3.3 trunk.
> I get handle of '/proc/version' using func below (e.g. handle=22).
> Now I want to get file size of that file. and read all contents into 
> THandleStream. But problem is: THandleSteam.Size gets 0.
> I guess THandleStream can override GetSize to get size smarter. Maybe 
> someone knows how?
> It will be very good, to access /proc/... by streams.

Don't use size. Just read data till you get no more data.

Many streams do not have a size. Socket or IO streams as prime examples.
Some of the encoding/decoding streams also do not have a real size.

Michael.


More information about the fpc-pascal mailing list