Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to use gzip.compressstring() function using chilkat. the syntax is

bool CompressString(const char *inStr, const char *outCharset, CkByteData &outBytes);
// COMPRESSSTRING_END
// COMPRESSSTRINGTOFILE_BEGIN .but i dont know how to implement it in c++.
below is the code i tried to acheive the following but wasn't succeeded in it

CkGzip gzip;

bool success;
CkByteData data;
char buffer[100] = {0};
success = gzip.CompressString("helloworld", "utf8", data);
data = buffer;
cout << buffer;

if (success != true) {
printf("%s\n", gzip.lastErrorText());
return;
}
Note: i want "hello world" to be in compressed form as an output.
Posted
Updated 24-Aug-15 20:53pm
v3

1 solution

The trivial way is using the system call to lauch the gzip executable. If you want ot use a library, have a look at zlib[^]. Finally if you want to implement yourlsef the compression algorithm...

[update]
Quote:
hey how to make a system call. like can you give me an example


of course (see also the documentation[^])

C
int rc = system("gzip foo.txt");
// TODO: check return status code


[/update]
 
Share this answer
 
v2
Comments
Member 11460314 21-Aug-15 7:09am    
hey how to make a system call. like can you give me an example

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900