This site is no longer active and is available for archival purposes only. Registration and login is disabled.

File Access


File Access

Postby jonah » Sep 8, 2007 @ 4:28pm

I am a little new to edgelib and c++ for that matter, so I wonder if one of you could help me with a little problem :

I have a edgelib PACK file that contain images and other resources. I can open the pack however I see only one method to get at the data

unsigned char *filemem;

ef.PackGetFileData(filemem, memsize, ctr);

from what I understand this loads the whole file into memory i.e. to "filemem" is this correct or am I wrong in my thinking?

If it does load the whole file then is it possible to only load specific parts of the file only and to use some sort of Seek command to goto an explicit position in the file?
The file I am loading is a dictionary and I need only to goto specific words in the file I don't want to load the whole file.

I know if I don't load the file from a pack file I can use the Seek command in ClassEFile but how do I do it with files in the Pack?


Thanks in advance.
jonah
pm Member
 
Posts: 4
Joined: Sep 8, 2007 @ 3:50pm


Postby edge » Sep 10, 2007 @ 10:55am

Hi Jonah,

It's unfortunately not possible to only read a part of a file when using PackGetFileData.

You need to read the whole file and use the pointer to access certain parts of the data. If the file is very big, it may be useful to split it into several smaller parts.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


ClassEFile

Postby jonah » Sep 10, 2007 @ 11:12am

What if I do not pack the file? i.e. use the file direct from the filesystem. In that case can I use ClassEFile's Seek and Read methods to load specific parts of the file. Or does that also load the whole file into memory?


Thanks
jonah
pm Member
 
Posts: 4
Joined: Sep 8, 2007 @ 3:50pm


Postby edge » Sep 11, 2007 @ 10:08am

Hi Jonah,

Sure, you're able to seek and read certain parts of the file when it's not packed and on the filesystem directly.

The reason why it needs the whole file in the package files, is because they are compressed (and it needs to decompress the whole file before it can be used).

If you mean seeking in an uncompressed file inside an EDGELIB pack, this feature is not available (yet).
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron