Welcome! Log In Create A New Profile

Advanced

Create archive from memory (zlib?)

Posted by blitter 
Create archive from memory (zlib?)
March 23, 2009 05:14PM
Hi, I would like to decompress an archive to memory, rather than to a new file. Also, to create an archive file from memory.

This is needed as the SD card is so slow!
Does anyone know of a small example or similar, thanks.
Re: Create archive from memory (zlib?)
March 23, 2009 06:01PM
look for examples of the zlib uncompress function.

It's a easy as :

unsigned long size = max_size * 2; 
int res = uncompress(uncompressed_data,&size,compressed_data,compressed_len);
if (res != 0){
  //failed
}



Edited 1 time(s). Last edit at 03/23/2009 06:03PM by scanff.
Re: Create archive from memory (zlib?)
March 23, 2009 08:01PM
Thanks, I'll look into "uncompress" from ogc/zlib.h and just use my own file system!
Re: Create archive from memory (zlib?)
March 30, 2009 06:42PM
I'm getting strange results with compress/uncompress.
Is there any code with an example around, which uses zlib.h compress() and uncompress()

It's been annoying me all this time, I've ended up streaming uncompressed data in the background (quicker still, but not what I want to achieve).


edit: I've mostly solved this (had an indexing problem), but only around half of the data is being extracted (or possibly added?)...I'll keep debugging :)

edit2: Another index needed to be 32bit, I underestimated the size (it all compresses so small!) cheers



Edited 3 time(s). Last edit at 03/30/2009 09:41PM by blitter.
Sorry, only registered users may post in this forum.

Click here to login