|
-
Dec 26th, 2000, 01:51 PM
#1
I decided I wanted to learn how to use compression in my programs, so I downloaded ZLib, and did all the stuff to makke it work with my compiler....
Ok, I got it working right, but I am not exactly sure how to use it...
I have this so far, which works fine, but I am not sure if it's the right way....
Code:
#include <iostream>
#include "zlib.h"
#include <conio.h>
using namespace std;
//int compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
//int uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen);
int main()
{
unsigned char * d;
const unsigned char s[5] = "test";
unsigned long ss = 5;
unsigned long ds = 100;
compress(d, &ds, s, ss);
unsigned char * d2;
unsigned long ss2 = 5;
unsigned long ds2 = 100;
uncompress(d2, &ds2, d, ds);
cout << d2;
getch();
return 0;
}
that works fine... I get a nice "test" out on the screen.. but like I said, I don't know if that is right....
Thanks,
Dennis
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|