Archived Forum Post

Index of archived forum posts

Question:

how to unzip into a string

Jul 29 '13 at 12:53

I just upgraded to 9.4.1, and the functions (e.g. inflateToString) I used to use to unzip into a string no longer exist. The function used in the example program also doesn't exist.

I suppose that CkZipEntry.UnzipToString or unzipToString are the methods I need to use, but the meaning of the parameters for those functions is not documented.

Please give me information on how to call those methods. (Using C++ libraries)


Answer

Sorry about that. As with all Chilkat C++ methods returning a string there are two forms, the uppercase and lowercase:

bool CkZipEntry::UnzipToString(int lineEndingBehavior, const char *srcCharset, CkString &outStr);
const char *CkZipEntry::unzipToString(int lineEndingBehavior, const char *srcCharset)

The lineEndingBehavior is as follows:

0 = leave unchanged.
1 = convert all to bare LF's
2 = convert all to CRLF's

The srcCharset arg tells the component how to interpret the bytes of the uncompressed file -- i.e. as utf-8, utf-16, windows-1252, etc.


Answer

Thanks for the help. On followup: before getting your answer I tried calling the method passing in 0 for both arguments. It seems to work :) What is the effect of passing 0 (NULL) as the srcCharset argument?