Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Citanje sadrzaja zip fajla iz C procedure

[es] :: C/C++ programiranje :: Citanje sadrzaja zip fajla iz C procedure

[ Pregleda: 2585 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

branimir.ts
Beograd

Član broj: 56661
Poruke: 127
*.

Sajt: www.geocities.com/brankob..


Profil

icon Citanje sadrzaja zip fajla iz C procedure03.06.2005. u 09:22 - pre 229 meseci

Da li neko zna kako bih mogao da iz obične C procedure pozovem DLL (konkretno u mom slučaju je zLib.dll - dll za baratanje sa zip fajlovima) i da nazive fajlova koje se nalaze u arhivi vratim u neki bafer, ali bez dodatnog petljanja sa C++ om ili wrapper klasama?

Hvala unapred
 
Odgovor na temu

dragansm
Dragan Smiljanic

Član broj: 38170
Poruke: 191
212.200.125.*



Profil

icon Re: Citanje sadrzaja zip fajla iz C procedure04.06.2005. u 00:36 - pre 229 meseci
Pokusaj da izvuces nesto iz ovoga (nisam ukljucivao VC IDE)

Code:

UINT res;
HINSTANCE hInst;
LPFNDLLFUNC1 fnFunc1;

hInst = LoadLibrary("zLib.dll");
if ( hInst )
{
   fnFunc1 = (LPFNDLLFUNC1)GetProcAddress( hInst, "compress");
   if ( fnFunc1 )
   {

// url: http://www.bzflag.org/doxygen/zlib_8h-source.html
//ZEXTERN int ZEXPORT compress OF((Bytef *dest,   uLongf *destLen,
00609                                  const Bytef *source, uLong sourceLen));
00610 /*
00611      Compresses the source buffer into the destination buffer.  sourceLen is
00612    the byte length of the source buffer. Upon entry, destLen is the total
00613    size of the destination buffer, which must be at least 0.1% larger than
00614    sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the
00615    compressed buffer.
00616      This function can be used to compress a whole file at once if the
00617    input file is mmap'ed.
00618      compress returns Z_OK if success, Z_MEM_ERROR if there was not
00619    enough memory, Z_BUF_ERROR if there was not enough room in the output
00620    buffer.
00621 */
       unsigned char *dst = ... tvoj bafer gde ces da smestas kompresovane podatke
       UINT dstLen = 1200;
       const unsigned char *src = ... ovih 1000 bajtova kompresujes
       res = fnFunc1( dst, &dstLen, src, 1000 );
       if ( res != Z_OK ) // 
       {
         // greska
       }
   }
   ...
   // ovo pozovi kad ti vise ne bude trebala ni jedna zip f-ja
   FreeLibrary(hInst);       
}


Let the force be with U jer postaces dzedaj ako ovako budes resavao.
Za svaku funkciju koju ces da koristis po jednom pozovi GetProcAddress.
A da nadjes zlib.lib i staticki linkujes ili ipak da nadjes neki wrapper i sebi ulepsas zivot?
Puno srece
 
Odgovor na temu

branimir.ts
Beograd

Član broj: 56661
Poruke: 127
*.

Sajt: www.geocities.com/brankob..


Profil

icon Re: Citanje sadrzaja zip fajla iz C procedure06.06.2005. u 10:50 - pre 229 meseci
Hvala puno Dragane na pomoci, ovo je zaista pomoglo kako treba. Jos samo da vidim sta sve ima u onom zlib headeru
Pozdrav
 
Odgovor na temu

dragansm
Dragan Smiljanic

Član broj: 38170
Poruke: 191
*.nat-pool.bgd.sbb.co.yu.



Profil

icon Re: Citanje sadrzaja zip fajla iz C procedure06.06.2005. u 11:59 - pre 229 meseci
Mozda ti je brzi nacin da vidis kako su to vec drugi uradili. Potrazi neki wrapper i pogledaj na koji nacin se u njemu koriste funkcije. Mislim da ti je to jednostavniji pristup nego da analiziras .h file. Sajt koji ti moze biti od korisiti: http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm
Pozdrav
 
Odgovor na temu

[es] :: C/C++ programiranje :: Citanje sadrzaja zip fajla iz C procedure

[ Pregleda: 2585 | Odgovora: 3 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.