zlib uncompression

In a program, I've imported the call "uncompress()" from zlib.dll using LoadLibrary(), then GetProcAddress() with the handle returned by LoadLibrary().  So now that I have support to call the function uncompress() from zlib.dll, how do I uncompress an entire file?  For 500 points, I wanna see code example that I can copy and paste (with relatively few modifications) :)

Thanks!
Chris O.
core123Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PIGCommented:
HINSTANCE instance = LoadLibrary("zlib.dll");
FARPROC uncomp = GetProcAddress(instance, "uncompress");
Byte *compr, *uncompr;
uLong comprLen, uncomprLen;
compr = yourData;
comprLen = uncomprLen = yourDataSize;
uncompr = (Byte*)calloc((uInt)uncomprLen, 1);
err = uncomp(uncompr, &uncomprLen, compr, comprLen);

If You want there is source of zlib
//ftp.uu.net/pub/archiving/zip/zlib/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
core123Author Commented:
Arg, but how would I use that with a file? I want this spoon-fed to me!
0
PIGCommented:
FILE* fileIn =  fopen("YourFileIn.XXX", "r");
FILE* fileOut =  fopen("YourFileOut.XXX", "w");
while (TRUE){
  Byte bufferIn[1024];
  uLong readB = fread((void*)bufferIn, 1024, 1, fileIn);
  if (!readB) break;
  Byte bufferOt[1024];
  uLong writeB = 0;
  YourUnompressFunction(bufferIn, readB, bufferOut, writeB);
  uLong realWB = fwrite(bufferOut, writeB, 1, fileOut);
  if ((readB < 1024) || (realWB < writeB)) break;
}
fclose(fileIn);
fclose(fileOut);
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.