should I open QFile before size()
-
Solution:
"The documentation states that QFileDevice::size() returns the size of the file. If the function were to require an open file, its documentation would say that. By convention, Qt doesn't document non-requirements." -
@DungeonLords
If it works without opening the file then I imagine it uses a call which has nothing to do with whether the file is open. I agree the docs are not clear on this. If you feel "unsure" about this behaviour, change to using qint64 QFileInfo::size() const,QFileInfo
for sure just looks at OS file information without opening it. -
@JonB said in should I open QFile before size():
I agree the docs are not clear on this
All QFile (not QIODevice) functions are working without open() first. Don't think that this should really be documented.
-
Solution:
"The documentation states that QFileDevice::size() returns the size of the file. If the function were to require an open file, its documentation would say that. By convention, Qt doesn't document non-requirements." -