#include #include #include int main(int argc, char**argv) { int r; const char* txt = "WWWWWWWWWWWWWWFAFSFASFASF AFSFASfasfas dasd asdpas sdadasdasdkl asd asldkasda das dasld asda asdd asd"; unsigned char compressed_buf[512]; unsigned char uncompressed_buf[512]; unsigned long compressed_size = sizeof(compressed_buf); unsigned long uncompressed_size = sizeof(uncompressed_buf); if ((r = compress (compressed_buf, &compressed_size, (const unsigned char*) txt, strlen(txt)))) { fprintf(stderr, "compression failed: %d\n", r); return 1; } fprintf(stdout, "original size: %d\n", strlen(txt)); fprintf(stdout, "compressed size: %d\n", compressed_size); if ((r = uncompress(uncompressed_buf, &uncompressed_size, compressed_buf, compressed_size))) { fprintf(stderr, "uncompression failed: %d\n", r); return 2; } uncompressed_buf[uncompressed_size] = 0; fprintf(stdout, "ORIG: %s\n", txt); fprintf(stdout, "NEW : %s\n", uncompressed_buf); return 0; }