[Qt-interest] How to copy an embedded resource file to the file system?
Stephen Jackson
spjackson42 at gmail.com
Tue Sep 22 11:39:08 CEST 2009
On Tue, Sep 22, 2009 at 12:06 AM, Marcelo Magno T. Sales wrote:
> Hello,
>
> I would like to copy a file which is embedded in the executable (as a qt
> resource) to the file system. How to achieve that?
> QFile::copy() fails with error 14 (copy error).
>
> I've tried something like:
> QFile(":/path/file").copy("/path/in/filesystem/file");
>
> or
>
> QFile file(":/path/file");
> file.copy("/path/in/filesystem/file");
>
> But it fails with the above mentioned error (checked with
> QFile::error())
>
> Thanks,
>
Both of the above methods work for me (Qt 4.5.1 on Linux), i.e. the
functions return true, the file is copied and the copy compares equal
(with cmp) to the original. What does errno indicate?
--
HTH,
Stephen Jackson
More information about the Qt-interest-old
mailing list