QFile: chop a file into parts
I am making a Qt application (4.7). Is there a way t开发者_运维问答o split a file easily with QFile
so that if I have a file x
, I can split it equally into n parts fileX1
, fileX2
, ... fileXn
?
As far as I know there is no in-build QFile method to split an existing file.
Depending on your use-case you can easily read the file into a QByteArray, split that into n parts and save those back to disc. (If you want an example of how to do that, just comment to this answer.)
There used to be an option to configure Qt, to build it with "large file support". Just Google for "qt large file support" (without the quotes), to see many references to this.
But I can't find any mention of this in the the Qt 4.7 Installation guide.
However, the option -no-largefile
is mentioned in the page Platform and Compiler Notes - X11.
精彩评论