copies file doesn't work well
HI.
I have to copy a file, from a directory to another(changing the name).
I use the static function
...but, often, it doesn't make the copy(it makes the copy very late). I also remove the dest file, if one with that name exists and use the flush() function to write the buffered data.
How can i obtain a fast written on the filesystem???
I use linux with ext3.
Re: copies file doesn't work well
QFile::copy() performs the copy in userspace, which is slow. If you are after speed, it's best to use dedicated methods. Linux has a very fast function for it called sendfile(). It is very efficient, but highly unportable - available only in Linux (other Unices might have it but with different semantics).
Re: copies file doesn't work well
i 'd like to have a portable solution.
Why the flush() function doesn't work?
Re: copies file doesn't work well
What would you like it to do? It won't speed up anything.
As for portability, I suggest using #ifdef directives and use sendfile() on Linux, some native function on Windows and QFile::copy() elsewhere.