Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, September 2007
QFile::size() with closed file. Size does not reflect actual size?


Message 1 in thread

Hi,
according to the QIODevice documentation: 

> If the device is closed, the size returned will not reflect the 
> actual size of the device.

Is this platform dependent? I experimented here with some code under Linux and 
I don't see a difference in the returned size of a file whether it is opened
or not. Or is this only invalid for QFile objects?

Guido


--
 [ signature omitted ] 

Message 2 in thread

On 08.09.07 15:16:55, Guido Seifert wrote:
> Hi,
> according to the QIODevice documentation: 
> 
> > If the device is closed, the size returned will not reflect the 
> > actual size of the device.
> 
> Is this platform dependent? I experimented here with some code under Linux and 
> I don't see a difference in the returned size of a file whether it is opened
> or not. Or is this only invalid for QFile objects?

See QFile::size(), its re-implemented so QIODevice constraints might not
apply. In particular its not a problem to retrieve the file size without
opening it on most systems (as that only involves looking up the size in
the directory node often). Also QFile::size() has a similar limitation
for non-FS files, like stuff in /proc.

Andreas

-- 
 [ signature omitted ]