[Qt-interest] Large File Support

Konrad Rosenbaum konrad at silmor.de
Tue Jul 28 09:29:19 CEST 2009


On Monday 27 July 2009, James Matta wrote:
> I know that in Qt4 large file support is on by default but I have a few
> questions about how it is handled in certain cases.
>
> Namely, suppose the program is being used on a system that doesn't have
> large file support. Perhaps it is a 32 bit linux. Or perhaps it is some
> weird USB external hard drive.

You need to make a few differences:

* the instruction set of the platform: this could be 32bit or 64bit (I don't 
think Qt supports any 16bit platform) - this has (almost) nothing to do 
with file sizes, eg. 32bit Linux supports large files

* the VFS layer of the operating system: this API sets the upper limit on 
what the system can handle, Linux and Windows both provide 64bit file 
size(*) APIs on this level; Qt knows about these limits when it is compiled 
and choses the large file API if available

(*) if you are interested in details: GCC provides a 64bit long long int 
type that works even on 32bit platforms (with some emulation inserted 
automatically in the background), so 32bit and 64bit Linux provide the same 
64bit file size types and system calls; 32bit Windows (win32) splits the 
file size up into two 32bit numbers

*the actual file system: this depends on how the file system is laid out, 
how many bytes are reserved for expressing data pointers, etc.pp.; this 
puts a practical limit on how large a file can grow on this particular 
path/drive; the operating system returns error codes if the size limits are 
exceeded and Qt translates those into its own errors, see the docu of 
QIODevice/QFile read/write/resize for details

> In this case how does Qt create large files? Does it break them into
> appropriately sized chunks and simply number them so that 1 filename can
> be used to access them? Does it simply throw an exception?

Qt returns errors if writing or reading fails. It never breaks files up.



	Konrad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090728/3d1d6985/attachment.bin 


More information about the Qt-interest-old mailing list