How to get file from project folder using RFile?
Hi I am developing Qt project and for file reading I use symbian c++ coding. Here is my code for that
RFs iFileServer;
User::LeaveIfError(iFileServer.Connect());
RFile aFile;
TInt err = aFile.Open(iFileServer,_L("file.zip"),EFileRead);
file.zip is located in S60 private\ec45d767\file.zip and it reads the file perfectly.
Now I have the file in my project folder resource\file1.zip and I added it in *.qrc file. I want to know how to mention this location in the above code.
Please give the solution.
Regards,
Bala
Re: How to get file from project folder using RFile?
Why do you need to use Symbian code for reading files in Qt application?
Re: How to get file from project folder using RFile?
[QUOTE=divanov;716901]Why do you need to use Symbian code for reading files in Qt application?[/QUOTE]
I tried to read *.zip and *.epub files using Qt code but didn't get solution or help for that. Using Symbian code I'm able to extract the files and get contents of them.
If you know how to open epub and zip format files using Qt, then it will be very helpful for me.
Regards,
Bala
Re: How to get file from project folder using RFile?
You still can check how Azardi does that.
[url]http://www.infogridpacific.com/igp/AZARDI/AZARDI%20-%20Downloads/Version%20History/[/url]
Qt resources are built in the binary and Symbian libraries do not have ready available solution for reading Qt resources.
Re: How to get file from project folder using RFile?
[QUOTE=BalajiR;716905]Using Symbian code I'm able to extract the files and get contents of them.
[/QUOTE]
True, Symbian provides an API for handling zip files, namely [URL="http://wiki.forum.nokia.com/index.php/How_to_read_ZIP_file"]CZipFile[/URL]. But you cannot access the contents of a zip archive by using RFs/RFile classes alone.
In Qt, there's qCompress/qUncompress, but with those it's only possible to (un)compress a stream of bytes using zlib compression methods - they cannot handle the ZIP file format directly. There are of course 3rd party libraries available that can.
Re: How to get file from project folder using RFile?
[QUOTE]Qt resources are built in the binary and Symbian libraries do not have ready available solution for reading Qt resources.[/QUOTE]
Then could you please tell me how to use the files which are in project folder using symbian code.
Re: How to get file from project folder using RFile?
[QUOTE=BalajiR;716964]Then could you please tell me how to use the files which are in project folder using symbian code.[/QUOTE]
Assuming you already know how to read the files from your application /private folder, all you need to do is to deploy the file(s) to the device - i.e. add them to the sis package.
Try the following code in your .pro file:
[CODE]
zipFiles.sources = resource\*.zip # assumes your files are in \resource folder
DEPLOYMENT += zipFiles
[/CODE]
Re: How to get file from project folder using RFile?
[QUOTE=treinio;717055]Assuming you already know how to read the files from your application /private folder, all you need to do is to deploy the file(s) to the device - i.e. add them to the sis package.
Try the following code in your .pro file:
[CODE]
zipFiles.sources = resource\*.zip # assumes your files are in \resource folder
DEPLOYMENT += zipFiles
[/CODE][/QUOTE]
Thanks. It works.