[Qt-interest] How to copy an embedded resource file to the file system?
Andre Somers
andre at familiesomers.nl
Tue Sep 22 09:35:46 CEST 2009
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())
>
I guess you'll have to do the writing yourself then. Just read the
resource, and write to the file system like you would with any file.
Maybe you should file a bugreport about your issue though, as I would
expect your method to work too (not the other way around, of course).
André
More information about the Qt-interest-old
mailing list