| View previous topic :: View next topic |
| Author |
Message |
Ooblik
Joined: 10 Apr 2008 Posts: 38
|
Posted: Sun May 17, 2009 2:20 pm Post subject: Zip Extraction |
|
|
| Anybody have a source code example on extracting zip files? |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sun May 17, 2009 3:32 pm Post subject: |
|
|
It's the same as on a PC. Just use zlib - it's part of the libraries in the toolchain for a reason.
>.> |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Sun May 17, 2009 6:39 pm Post subject: |
|
|
| Well you do need to but something around zlib which handles the zip format itself but yes not hard :) |
|
| Back to top |
|
 |
willow :--)
Joined: 13 Jan 2007 Posts: 126
|
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Mon May 18, 2009 1:18 am Post subject: |
|
|
| i posted a library that was made using minizip that works on psp on my website kehon.izfree.com but not to sure how its doing now |
|
| Back to top |
|
 |
Ooblik
Joined: 10 Apr 2008 Posts: 38
|
Posted: Tue May 19, 2009 6:32 pm Post subject: |
|
|
THANKS coolkehon your library still works perfectly!
Now I have a new problem:
| Code: | ... if(unzGetCurrentFileInfo(zipFd, &curZipFileInfo, fNameBuf, sizeof(fNameBuf), NULL, 0, NULL, 0) == UNZ_OK) {
if(curZipFileInfo.uncompressed_size > 0) {
printf("Allocate %d Bytes for %s\n", (int)(curZipFileInfo.uncompressed_size)+1, fNameBuf);
fileBuff = (char *)realloc(fileBuff, curZipFileInfo.uncompressed_size+1);... |
This only allocates 4 bytes (int ?). How can I fix it? Sorry I'm new to dynamic memory allocation XD
I know this is probably some stupid little thing I'm just not thinking of... |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Tue May 19, 2009 8:23 pm Post subject: |
|
|
| Is fileBuff used before? Is it null? Check the realloc return value. If fileBuff isn't already assigned to an allocated address then it has to be null for realloc to work. |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Wed May 20, 2009 2:58 am Post subject: |
|
|
| i did this once by accident it was a pointer problem dont rember if it was like this or what but i was writting a pointer instead of the data to the pointer or vice versa make sure you have all the info correct with pointers because the size of a pointer i believe is 4 bytes |
|
| Back to top |
|
 |
Ooblik
Joined: 10 Apr 2008 Posts: 38
|
Posted: Wed May 20, 2009 11:17 am Post subject: |
|
|
| coolkehon wrote: | | i did this once by accident it was a pointer problem dont rember if it was like this or what but i was writting a pointer instead of the data to the pointer or vice versa make sure you have all the info correct with pointers because the size of a pointer i believe is 4 bytes |
Yeah its allocating the size of the pointer int (4 bytes) not the value of the pointer represented as an integer... if that makes sense... |
|
| Back to top |
|
 |
|