Re: How do I store filenames using zlib?

Jody Goldberg <[email protected]> Fri, 17 Jun 2005 07:31:13 -0400
Newsgroups gmane.comp.openoffice.devel.xml
Message-ID <[email protected]>
On Thu, Jun 16, 2005 at 05:51:44PM +0200, David Faure wrote:
> On Thursday 16 June 2005 17:13, EsaK wrote:
> > Hello. 
> > I'm hacking away at my C DLL which generates .SXC files... hopefully 
> > soon in the future. I'm kinda stuck right now --- I've been staring at 
> > zlib docs and examples and source for a few days now, and I still 
> > haven't figured out, as in I have absolutely no idea how I can get my 
> > std::string to be written as a "content.xml" _into_ the archive. Um. 
> > Help?
> 
> You're confusing zlib (which is just about compression, like gzip does) and ZIP 
> (which is a package format, with indexes etc.). You have to find a ZIP 
> implementation to do this, zlib isn't enough.

libgsf will do it for you.

file   = gsf_output_stdio_new ("foo.sxc", NULL);
zip    = gsf_outfile_zip_new (file, NULL);
header = gsf_outfile_new_child_full (zip, "content.xml", FALSE,
				     "compression-level", 0,
				     NULL);
gsf_output_write (header, "blah", 4);