Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » StringUnZip example needed
StringUnZip example needed [message #60075] Sat, 05 August 2023 23:01 Go to next message
forlano is currently offline  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 Go to previous messageGo to next message
omari is currently offline  omari
Messages: 265
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.
Re: StringUnZip example needed [message #60077 is a reply to message #60076] Sun, 06 August 2023 13:56 Go to previous message
forlano is currently offline  forlano
Messages: 1185
Registered: March 2006
Location: Italy
Senior Contributor
omari wrote on Sun, 06 August 2023 13:20
       String ss = StringUnZip(s).ReadFile();



This was enough! Very easy and useful.
Thanks a lot
Luigi
Previous Topic: Remove all children from TopWindow/ParentCtrl
Next Topic: Scroll Panel
Goto Forum:
  


Current Time: Thu May 02 09:41:07 CEST 2024

Total time taken to generate the page: 0.03559 seconds