Home » U++ Library support » U++ Library : Other (not classified elsewhere) » StringUnZip example needed
StringUnZip example needed [message #60075] |
Sat, 05 August 2023 23:01 |
|
forlano
Messages: 1185 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
I have in the String s a whole zip archive (there is no physical zip file on the hard drive and I do not want to save it and then use FileUnZip to retrieve its files).
I found the method StringUnZip(const String& s) in zip.h (plugin/zip).
I suppose it can extract the files contained in the zip archive. If this is true does anybody know how this can be done? You can suppose that the zip archive contains just one text file. So I would like to get the file, say f, within the zip archive and assign it to the String ss.
Many thanks in advance,
Luigi
[Updated on: Sat, 05 August 2023 23:21] Report message to a moderator
|
|
|
Re: StringUnZip example needed [message #60076 is a reply to message #60075] |
Sun, 06 August 2023 13:20 |
omari
Messages: 266 Registered: March 2010
|
Experienced Member |
|
|
String ss = StringUnZip(s).ReadFile();
a complete example (inspired from reference/Zip) :
StringUnZip unzip(zipStr);
while(!(unzip.IsEof() || unzip.IsError())) {
LOG("Path:" << unzip.GetPath());
LOG(" Time:" << unzip.GetTime());
if(unzip.IsFile()()) {
LOG(" Size:" << unzip.GetLength());
String content = unzip.ReadFile();
}
else
unzip.SkipFile();
}
regards
omari.
|
|
|
|
Goto Forum:
Current Time: Wed May 15 03:54:04 CEST 2024
Total time taken to generate the page: 0.02846 seconds
|