f



create a zip file with existing files in it

I try the zip example described in the doc. 
It worked that way. 

But now I want to add existing files to a new created zip. 

first the code 

<code>
void OBApp::Test () 
{ 
    wxFFileOutputStream out(_T("C:\\test.zip")); 
    wxZipOutputStream   zip(out); 
    wxTextOutputStream  txt(zip); 

    // ?? 
    wxFileInputStream   strFile("C:\\autoexec.bat"); 

    wxString sep(wxFileName::GetPathSeparator()); 

    zip.PutNextEntry(_T("C:\\autoexec.bat")); 
    txt << _T("Some text for entry1.txt\n"); 

    zip.PutNextEntry(_T("C:\\ilvw2\\ilvw2.log")); 
    txt << _T("Some text for entry2.txt\n"); 
}
</code>


Now I am quit confused about all the streams there. ;) 

I think I need a special (file handling) output stream on the zip-side. 
And then I need a file representated as a stream to. 
And then let date two streams like this. 

zipoutputstream << filestream; 

Is the logic right? But how is this implemented?
0
Christian
4/5/2006 11:01:46 PM
comp.soft-sys.wxwindows 21076 articles. 0 followers. Post Follow

1 Replies
623 Views

Similar Articles

[PageSpeed] 12

On Thursday 06 Apr 2006 00:01, Christian Buhtz wrote:
> But now I want to add existing files to a new created zip.
>
> Is the logic right? But how is this implemented?

Hi, 

e.g. (without any error checks):

    wxFFileInputStream in(_T("test.file"));
    wxFFileOutputStream out(_T("test.zip"));

    wxZipOutputStream zip(out);
    zip.PutNextEntry(_T("test.file"));
    zip.Write(in);

HTH,
Mike 

---------------------------------------------------------------------
To unsubscribe, e-mail: wx-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wx-users-help@lists.wxwidgets.org

0
mike
4/6/2006 8:48:19 AM
Reply: