All pastes #434980 Raw Edit

Someone

public cpp v1 · immutable
·published 2007-04-11 18:32 UTC
rendered paste body
    wxZipEntryPtr entry;    wxFFileInputStream in(filePath);    wxZipInputStream zip(in);    size_t buffer_size = 1024;	char *buffer = new char[buffer_size];	wxString fileContent;	wxFile *file = new wxFile;    while (entry.reset(zip.GetNextEntry()), entry.get() != NULL) {        wxString name = entry->GetName(); // Get the name of the file from meta-data        fileContent = "";		//this->RecreateDirectoryStructureToCopyFile(name, targetDirectory);		if(!entry->IsDir()) {			while(!zip.Eof()) { // while we did not reach the end of the file				zip.Read(buffer, buffer_size); // We read some of the file included in the zip archive				fileContent += buffer; // and append it to fileContent				wxMessageBox(fileContent, "ee", wxOK);				if(zip.LastRead() < 1)	// Last read was 0 byte ? we stop.					break;			}			// Now that we have read the file from the archive, we save it on the drive.			file->Open(targetDirectory + "\\" + name, wxFile::write);			file->Write(fileContent);			file->Close();		}    }    delete buffer;    delete file;